Skip to content

Commit

Permalink
Replace the internal usage of Cstruct.t by string (mirage#146)
Browse files Browse the repository at this point in the history
Originally, we used Cstruct.t (bigarray) for interfacing. Instead, we use string now.
The benefit is that allocating a string is cheap, and in line with OCaml's GC.

After some years of stalling, we included benchmarks in bench/speed.ml fot the EC
operations in mirage#192  (sign, verify, generate for EC/EdDSA; and ECDH). The result for
thi change is a factor between 2 and 2.5.

The external API (mirage_crypto_ec.mli) does not change at all. There are various
other cleanups in the code, such as providing a layer to isolate the C calls (which
receive a bytes buffer for the result value, and thus mutate this buffer) to be
immutable.

Co-authored-by: Pierre Alain <pierre.alain@tuta.io>
Co-authored-by: Hannes Mehnert <hannes@mehnert.org>
Co-authored-by: Reynir Björnsson <reynir@reynir.dk>
Reviewed-by: Virgile Robles <virgile.robles@protonmail.ch>
Reviewed-by: Pierre Alain <pierre.alain@tuta.io>
  • Loading branch information
4 people authored and Firobe committed Apr 8, 2024
1 parent e90c764 commit 24c7cb7
Show file tree
Hide file tree
Showing 13 changed files with 815 additions and 702 deletions.
2 changes: 1 addition & 1 deletion ec/dune
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
(library
(name mirage_crypto_ec)
(public_name mirage-crypto-ec)
(libraries cstruct eqaf.cstruct mirage-crypto mirage-crypto-rng)
(libraries cstruct eqaf mirage-crypto mirage-crypto-rng)
(foreign_stubs
(language c)
(names p224_stubs np224_stubs p256_stubs np256_stubs p384_stubs np384_stubs
Expand Down
Loading

0 comments on commit 24c7cb7

Please sign in to comment.