From 5d89ca6706e2612c1dc336f7fd3b4be9f4df5429 Mon Sep 17 00:00:00 2001 From: David Garske Date: Wed, 9 Jul 2025 22:56:18 +0100 Subject: [PATCH] Fix build issue with ML-DSA 44 only. Fix --enable-mlkem=all to enable features (keygen/enc/dec) to match --enable-dilithium behavior and allow uses like: `--enable-mlkem=all,512,small`. Fix issue building mem track with missing `PRINT_HEAP_ADDRESS` (reproduced with `--enable-trackmemory=verbose --enable-stacksize=verbose`). ``` wolfcrypt/src/dilithium.c:6696:21: error: expected expression before '}' token 6696 | } | ``` --- configure.ac | 14 ++++++++------ wolfcrypt/src/dilithium.c | 1 - wolfcrypt/test/test.c | 2 ++ 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/configure.ac b/configure.ac index a5c7413f7..393cdac43 100644 --- a/configure.ac +++ b/configure.ac @@ -1470,18 +1470,20 @@ ENABLED_MLKEM_DECAPSULATE=no for v in `echo $ENABLED_MLKEM | tr "," " "` do case $v in - yes|all) + yes) ENABLED_MLKEM512=yes ENABLED_MLKEM768=yes ENABLED_MLKEM1024=yes ENABLED_MLKEM_MAKE_KEY=yes ENABLED_MLKEM_ENCAPSULATE=yes ENABLED_MLKEM_DECAPSULATE=yes - if test "$v" = "all" - then - ENABLED_ML_KEM=yes - ENABLED_ORIGINAL=yes - fi + ;; + all) + ENABLED_MLKEM_MAKE_KEY=yes + ENABLED_MLKEM_ENCAPSULATE=yes + ENABLED_MLKEM_DECAPSULATE=yes + ENABLED_ML_KEM=yes + ENABLED_ORIGINAL=yes ;; no) ;; diff --git a/wolfcrypt/src/dilithium.c b/wolfcrypt/src/dilithium.c index 65e301473..148d804f2 100644 --- a/wolfcrypt/src/dilithium.c +++ b/wolfcrypt/src/dilithium.c @@ -6682,7 +6682,6 @@ static int dilithium_sign_with_seed_mu(dilithium_key* key, ze += DILITHIUM_GAMMA1_17_ENC_BITS / 2 * DILITHIUM_N / 4; } - else #endif #if !defined(WOLFSSL_NO_ML_DSA_65) || \ !defined(WOLFSSL_NO_ML_DSA_87) diff --git a/wolfcrypt/test/test.c b/wolfcrypt/test/test.c index 2b93b9d91..2020b907c 100644 --- a/wolfcrypt/test/test.c +++ b/wolfcrypt/test/test.c @@ -110,6 +110,8 @@ const byte const_byte_array[] = "A+Gd\0\0\0"; heap_baselineAllocs = wolfCrypt_heap_peakAllocs_checkpoint(); \ heap_baselineBytes = wolfCrypt_heap_peakBytes_checkpoint(); \ } +#define PRINT_HEAP_ADDRESS(p) \ + printf("Allocated address: %p", (void *)(p)); #else #define PRINT_HEAP_CHECKPOINT(b, i) WC_DO_NOTHING; #define PRINT_HEAP_ADDRESS(p) WC_DO_NOTHING;