Skip to content

Commit

Permalink
mirage-crypto-ec: Set bytes used for "zero" to '\000' (#226)
Browse files Browse the repository at this point in the history
Cstruct.create does this. If we don't initialize bytes with '\000',
Field_element.zero can be something else than '\000'. It's a fix for
mirleft/ocaml-x509#167.

Co-authored-by: Hannes Mehnert <[email protected]>
  • Loading branch information
dinosaure and hannesm authored Apr 23, 2024
1 parent 47751da commit 38bde3a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion ec/mirage_crypto_ec.ml
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,8 @@ module Make_field_element (P : Parameters) (F : Foreign) : Field_element = struc
b_uts tmp

let zero =
b_uts (create ())
let b = Bytes.make P.fe_length '\000' in
b_uts b

let one =
let fe = create () in
Expand Down

0 comments on commit 38bde3a

Please sign in to comment.