Repository navigation
crypto: Let a build leave ML-KEM-768 out - #2486
gabrielmancini wants to merge 1 commit into
Conversation
|
non-blocking nits: PR review:
|
With libsodium new enough to provide it, ML-KEM-768 is compiled in whenever AVM_USE_LIBSODIUM is on. On ESP32 that is 52,880 bytes of flash (ESP-IDF v5.5.5, libsodium 1.0.22, the same build with and without it), which a device without a use for post-quantum key encapsulation pays for anyway. AVM_DISABLE_MLKEM (CMake) and CONFIG_AVM_DISABLE_MLKEM (ESP32 Kconfig), both off by default, leave it out: crypto:generate_key(mlkem768, []), crypto:encapsulate_key/2 and crypto:decapsulate_key/3 are then unavailable, as in a build without ML-KEM. Ed25519 and X25519 stay. Signed-off-by: Gabriel Mancini <gabriel.mancini@gmail.com>
e58ba54 to
2367b66
Compare
|
Thanks for the review. I took both documentation points, amended into the commit:
On the test: agreed, the current suite can't tell an opt-out build from a default build that lost ML-KEM. A paired build against the same ML-KEM-capable libsodium, checking with On the
That is 52,880 bytes. The number in the PR description had come from our app partition losing about that much when ML-KEM arrived with the libsodium update, not from a paired build. The failing jobs (Elixir master |
With a libsodium new enough to provide it, ML-KEM-768 is compiled in whenever
AVM_USE_LIBSODIUMis on. On ESP32 that costs about 52 KB of flash, 45 KB of it libsodium's unrolled Keccak. A device with no use for post-quantum key encapsulation pays for it anyway: on a 4 MB board the free space in our app partition went from 111 KB to 57 KB.AVM_DISABLE_MLKEM(CMake) andCONFIG_AVM_DISABLE_MLKEM(ESP32 Kconfig), both off by default, leave it out.crypto:encapsulate_key/2andcrypto:decapsulate_key/3are then missing, as in a build without libsodium, andtest_crypto_pkalready skips itself in that case.Our fleet of ESP32 boards has run with
CONFIG_AVM_DISABLE_MLKEM=ysince late October.