Dear everyone,
it is my delight to release mirage-crypto* in version 2.4.1 ([new release] mirage-crypto (6 packages) (2.4.1) by hannesm · Pull Request #30568 · ocaml/opam-repository · GitHub). There have been a series of releases since late July with 2.2.0 (July 27th, 2.3.0 Aug 7th, 2.4.0 Aug 17th, 2.4.1 Aug 26th). The reasoning behind is that several people used LLM to find some issues in the implementation that we are fixing in the process. It is likely there’ll be more releases. We try to limit the releases we cut during each month (the goal is at most one release per month). Me as a maintainer of that package is as well at the edge of what I can do (time-wise – please consider donating at Robur - Open Source Software Cooperative or via GitHub spoinsors – in the case you use this piece of software). There won’t be backports of fixes. The only supported release is the latest one.
Even more appreciated would be if someone jumps in, reads code, reviews pull requests when they come in, contributes code cleanups (please don’t submit any LLM generated improvements directly, but do careful reviews of them). Especially since now everyone is on the red team.
The performance of mirage-crypto has decreased due to added checks, but only in a small margin as far as I can observe on hardware that I use. Feel free to conduct your own benchmarks (there is bench/speed.ml available), and propose improvements.
Now, the changes range between fixes and cleanups to has a published advisory. There’s not always a clear border. The full list can be found in the CHANGES file, or in the commit history. I encourage everyone to update to the latest release, and not use any previous release. As mentioned, some advisories are out, and for other fixes we think they may not need an advisory (although it may be that other implementations issues advisories for such fixes, so please be careful – you can as well submit PRs to ocaml/security-advisories if you think some specific fixes are important enough to get an advisory).
The fixes in more detail follow. Thanks to Eric Ebinger, Thomas Gazagnaire, and Anil Madhavapeddy for the reports. And to Tarides for make it possible that I spend some time on reviewing, merging, and releasing mirage-crypto.
mirage-crypto-ec
- timing attack on NIST lookup tables OSV - Open Source Vulnerabilities mirage-crypto-ec: avoid timing leak in table lookup · mirage/mirage-crypto@1a61aee · GitHub
- now uses blinding Re-add blinding for NIST elliptic curves (Dsa.sign) by hannesm · Pull Request #285 · mirage/mirage-crypto · GitHub
- do not accept point at infinity as ECDSA key OSV - Open Source Vulnerabilities ECDSA: error if infinity was provided as public key · mirage/mirage-crypto@ca84f5e · GitHub
- return early from scalar_mult in ED25519 ed25519: return early in double_scalar_mult on decode failure · mirage/mirage-crypto@3b4ba91 · GitHub
- X25519 compare in constant time X25519: compare the shared secret against zero in constant time · mirage/mirage-crypto@1aa4cf5 · GitHub
- properly encode the compressed point 0 Mirage_crypto_ec: encode the compressed point at infinity as 0x00 · mirage/mirage-crypto@94cba54 · GitHub
mirage-crypto
- decrypt only after AEAD tag has been verified OSV - Open Source Vulnerabilities AEAD: decrypt only after the tag has been validated · mirage/mirage-crypto@25e7570 · GitHub
- more bounds checks chacha20: reject negative offsets in the AEAD bounds check by samoht · Pull Request #281 · mirage/mirage-crypto · GitHub Reject negative len in the cipher _into bounds checks by samoht · Pull Request #290 · mirage/mirage-crypto · GitHub Point.of_octets: add missing bound check for compressed points · mirage/mirage-crypto@1f0bf67 · GitHub OSV - Open Source Vulnerabilities poly1305: reject negative lengths in mac_into · mirage/mirage-crypto@7b5650b · GitHub
- avoid unaligned access Fix an unaligned access that caused a bus error on armhf by glondu · Pull Request #292 · mirage/mirage-crypto · GitHub
- reject bad ChaCha20 keys ChaCha20: already in of_secret reject any non 16 or 32 byte key · mirage/mirage-crypto@7f505b0 · GitHub
- avoid padding when adata is aligned CCM: avoid padding aligned associated data · mirage/mirage-crypto@999cac9 · GitHub
- avoid too long CCM messages CCM: reject messages that do not fit in the length field by torinnd · Pull Request #304 · mirage/mirage-crypto · GitHub
- AEAD ciphers avoid counter wrapping Reject wrapping stream cipher counters by torinnd · Pull Request #305 · mirage/mirage-crypto · GitHub Use block limits for stream ciphers by torinnd · Pull Request #306 · mirage/mirage-crypto · GitHub CCM: reject messages that do not fit in the length field by torinnd · Pull Request #304 · mirage/mirage-crypto · GitHub
mirage-crypto-rng
- the entropy harvesting test is now executed at initialization time of mirage-crypto-mkernel and mirage-crypto-rng-mirage Add Mirage_crypto_rng.entropy_test for testing entropy harvesting by hannesm · Pull Request #282 · mirage/mirage-crypto · GitHub
- fix entropy source IDs rng: reuse registered entropy sources · mirage/mirage-crypto@86161d1 · GitHub
- urandom RNG make it so that a fork doesn’t repeat numbers mirage-crypto-rng.unix: avoid duplicate output after fork by torinnd · Pull Request #302 · mirage/mirage-crypto · GitHub
- detect RDSEED properly detect RDSEED when the maximum basic CPUID leaf is exactly 7 · mirage/mirage-crypto@0f858a9 · GitHub
- mirage-crypto-rng-mkernel initialize by default now seeds Stdlib.Random (since this is used by standalone virtual machines – unikernels – where Random doesn’t get too much entropy) mirage-crypto-rng-mkernel: when the RNG is initialized, seed Stdlib.Random by hannesm · Pull Request #300 · mirage/mirage-crypto · GitHub
mirage-crypto-pk
- DSA avoid division by 0 dsa: avoid a divide-by-zero when k is 0 by samoht · Pull Request #289 · mirage/mirage-crypto · GitHub
- RSA avoid Invalid_argument when message is 2 OSV - Open Source Vulnerabilities Avoid raising Invalid_argument in Rsa.encrypt_z, Rsa.decrypt_z. · mirage/mirage-crypto@a0f59a0 · GitHub
- fix hardcoded DH groups mirage-crypto-pk: fix hardcoded Dh parameters by hannesm · Pull Request #297 · mirage/mirage-crypto · GitHub
- fix decoding of OAEP without a separator RSA.OAEP: reject encodings without a separator · mirage/mirage-crypto@eca6fb3 · GitHub