Hey,
we’re happy to announce mirage-crypto 0.11.3 (which just got merged to opam-repository), which includes huge performance improvements for elliptic curves. The API didn’t change at all
Background
Mirage-crypto, despite its name, is a crypographic library for OCaml. It provides hash functions (MD5, SHA1, SHA2), symmetric ciphers (DES, AES, ChaCha20, RC4), asymmetric cryptography (RSA, DSA, DH, ECDSA/EdDSA, ECDH). It originates from nocrypto (see the blog post from 2014) by David Kaloper.
You can use mirage-crypto in any OCaml application on Linux, macOS, or Windows.
release 0.11.3
The background story is that we finally merged the “use bytes instead of Cstruct.t” PR which was opened ~2.5 years ago by @dinosaure. We reviewed that, and did some benchmarks. And even went a bit further and are now using string
(instead of bytes
). See https://blog.robur.coop/articles/speeding-ec-string.html for further details.
Another PR worth mentioning is use windowed algorithm for base scalar multiplication from Virgile Robles – now some precomputed tables are shipped (same approach was done for 25519 already).
See this PR (and the release notes) for some detailed performance numbers on different CPUs – the P256 sign operation is around 10x faster than older releases. This is still 5 times slower than OpenSSL - but then we use fiat-crypto instead of handcrafted assembly code. We’re keen to improve the performance even further – ideas, observations, experiments and PRs are very welcome. We investigated benchmarking of e.g. digest algorithms across the OCaml ecosystem and OpenSSL as baseline and welcome improvements and further work on that (especially AES-GCM and Poly1305-ChaCha20 are painfully slow compared to OpenSSL).
Other improvements and fixes include support for Loongarch, NetBSD, use rdtime instead of rdcycle on RISC-V when in user mode, initial support for CL.EXE. Thanks to everyone involved in this released: @jbeckford @reynir @dinosaure @palainp @edwin
The full changelog may be worth to read.
Future roadmap (breaking changes)
Also, please note if you’re using mirage-crypto that we’ll revise the API and no longer use Cstruct.t / bigarrays, but instead bytes/string. 0.11.3 will be the last release using Cstruct.t. The hash functionality (Mirage_crypto.Hash
) will also be removed (since digestif implements them nicely). Please voice your concerns / ideas at Roadmap for 1.0 release · Issue #205 · mirage/mirage-crypto · GitHub