From 3333de37875f4cad1263ee14861ff3b29ad60d5d Mon Sep 17 00:00:00 2001 From: Calascibetta Romain Date: Sat, 20 Apr 2024 14:38:26 +0200 Subject: [PATCH] Set a new bytes used for elliptic curves computations to '\000' 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. --- ec/mirage_crypto_ec.ml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ec/mirage_crypto_ec.ml b/ec/mirage_crypto_ec.ml index 5c1e47ed..f6b0d726 100644 --- a/ec/mirage_crypto_ec.ml +++ b/ec/mirage_crypto_ec.ml @@ -135,7 +135,7 @@ end module Make_field_element (P : Parameters) (F : Foreign) : Field_element = struct let b_uts b = Bytes.unsafe_to_string b - let create () = Bytes.create P.fe_length + let create () = Bytes.make P.fe_length '\000' let mul a b = let tmp = create () in