File tree Expand file tree Collapse file tree 2 files changed +5
-3
lines changed Expand file tree Collapse file tree 2 files changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -141,9 +141,8 @@ let answer_server_hello state (ch : client_hello) sh secrets raw log =
141
141
142
142
let * () =
143
143
if max_protocol_version state.config.protocol_versions = `TLS_1_3 then
144
- let piece = String. sub sh.server_random 24 8 in
145
- let * () = guard (not (String. equal Packet. downgrade12 piece)) (`Fatal `Downgrade12 ) in
146
- guard (not (String. equal Packet. downgrade11 piece)) (`Fatal `Downgrade11 )
144
+ let * () = guard (not (Utils. sub_equal ~off: 24 ~len: 8 Packet. downgrade12 sh.server_random)) (`Fatal `Downgrade12 ) in
145
+ guard (not (Utils. sub_equal ~off: 24 ~len: 8 Packet. downgrade11 sh.server_random)) (`Fatal `Downgrade11 )
147
146
else
148
147
Ok ()
149
148
in
Original file line number Diff line number Diff line change @@ -35,3 +35,6 @@ let rec first_match l1 = function
35
35
| [] -> None
36
36
| x ::_ when List. mem x l1 -> Some x
37
37
| _ ::xs -> first_match l1 xs
38
+
39
+ let sub_equal ~off ~len v x =
40
+ v = String. sub x off len
You can’t perform that action at this time.
0 commit comments