Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove evaluated Cstruct.hexdump_pp on guards which slow down our process #209

Merged
merged 3 commits into from
Jan 24, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 6 additions & 6 deletions src/engine.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1266,8 +1266,8 @@ let incoming_data ?(add_timestamp = false) err (ctx : keys) hmac_algorithm
let* () =
guard
(Cstruct.length dec >= hdr_len)
(Result.msgf "payload too short (need %d bytes): %a" hdr_len
Cstruct.hexdump_pp dec)
(Result.msgf "payload too short (need %u bytes): %u" hdr_len
(Cstruct.length dec))
in
(* TODO validate replay packet id and ordering *)
Log.debug (fun m ->
Expand All @@ -1279,8 +1279,8 @@ let incoming_data ?(add_timestamp = false) err (ctx : keys) hmac_algorithm
let* () =
guard
(Cstruct.length data >= Packet.id_len + tag_len)
(Result.msgf "payload too short (need %d bytes): %a"
(Packet.id_len + tag_len) Cstruct.hexdump_pp data)
(Result.msgf "payload too short (need %u bytes): %u"
(Packet.id_len + tag_len) (Cstruct.length data))
in
let replay_id, tag, payload =
let sn, rest = Cstruct.split data Packet.id_len in
Expand All @@ -1302,8 +1302,8 @@ let incoming_data ?(add_timestamp = false) err (ctx : keys) hmac_algorithm
let* () =
guard
(Cstruct.length data >= Packet.id_len + tag_len)
(Result.msgf "payload too short (need %d bytes): %a"
(Packet.id_len + tag_len) Cstruct.hexdump_pp data)
(Result.msgf "payload too short (need %u bytes): %u"
(Packet.id_len + tag_len) (Cstruct.length data))
in
let replay_id, tag, payload =
let sn, rest = Cstruct.split data Packet.id_len in
Expand Down