From 9b1f15c85c5220d246f6ca3d625adc3b4d3ecebf Mon Sep 17 00:00:00 2001 From: Aidan Garske Date: Wed, 25 Nov 2026 14:24:10 -0800 Subject: [PATCH 1/4] Bump wolfSSL submodule for the one-shot HMAC API wolfHSM needs --- lib/wolfssl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/wolfssl b/lib/wolfssl index f8a805dd64..c81176ab76 160000 --- a/lib/wolfssl +++ b/lib/wolfssl @@ -1 +1 @@ -Subproject commit f8a805dd64321bb4b396b99fa99b170b5b9cd3d7 +Subproject commit c81176ab76f02538ea8caaa414bb4390adaa7c7e From d9d69041313dea1ec4c3846cd59ad31b2fc77406 Mon Sep 17 00:00:00 2001 From: Aidan Garske Date: Wed, 25 Nov 2026 15:14:07 -0800 Subject: [PATCH 2/4] Initialize the key object before decoding an imported public key in keygen --- tools/keytools/keygen.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/tools/keytools/keygen.c b/tools/keytools/keygen.c index fe96bf4612..f22a4869ba 100644 --- a/tools/keytools/keygen.c +++ b/tools/keytools/keygen.c @@ -1503,13 +1503,15 @@ static void key_import(uint32_t ktype, const char *fname, uint32_t id_mask) if (readLen > (int)keySz) { if (ktype == AUTH_KEY_ECC256 || ktype == AUTH_KEY_ECC384 || ktype == AUTH_KEY_ECC521) { - initKey = ret = wc_EccPublicKeyDecode(buf, &keySzOut, eccKey, readLen); + initKey = ret = wc_ecc_init(eccKey); + if (ret == 0) + ret = wc_EccPublicKeyDecode(buf, &keySzOut, eccKey, readLen); if (ret == 0) { ret = wc_ecc_export_public_raw(eccKey, buf, &qxSz, buf + keySz / 2, &qySz); } - else { + else if (initKey == 0) { /* Not DER. A keystore slot is zero-padded out to the widest * algorithm in the build, so a raw key read back out of one * has nothing but zeros past its own length and the @@ -1529,8 +1531,10 @@ static void key_import(uint32_t ktype, const char *fname, uint32_t id_mask) wc_ecc_free(eccKey); } else if (ktype == AUTH_KEY_ED25519) { - initKey = ret = wc_Ed25519PublicKeyDecode(buf, &keySzOut, - ed25519Key, readLen); + initKey = ret = wc_ed25519_init(ed25519Key); + if (ret == 0) + ret = wc_Ed25519PublicKeyDecode(buf, &keySzOut, + ed25519Key, readLen); if (ret < 0) printf("error: wc_Ed25519PublicKeyDecode failed on %s\n", fname); @@ -1543,8 +1547,10 @@ static void key_import(uint32_t ktype, const char *fname, uint32_t id_mask) wc_ed25519_free(ed25519Key); } else if (ktype == AUTH_KEY_ED448) { - initKey = ret = wc_Ed448PublicKeyDecode(buf, &keySzOut, - ed448Key, readLen); + initKey = ret = wc_ed448_init(ed448Key); + if (ret == 0) + ret = wc_Ed448PublicKeyDecode(buf, &keySzOut, + ed448Key, readLen); if (ret == 0) ret = wc_ed448_export_public(ed448Key, buf, &qxSz); From d349c66fafdccedaccb1d61f4128a3a5d4df3c03 Mon Sep 17 00:00:00 2001 From: Aidan Garske Date: Wed, 25 Nov 2026 15:14:07 -0800 Subject: [PATCH 3/4] Link the AArch64 ML-DSA NEON port file when ML-DSA is built with ARM asm --- options.mk | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/options.mk b/options.mk index 6bb2b4c064..8e0ad9039b 100644 --- a/options.mk +++ b/options.mk @@ -2685,6 +2685,10 @@ ifeq ($(ARCH),AARCH64) ifneq (,$(filter %/wolfcrypt/src/chacha.o,$(WOLFCRYPT_OBJS))) WOLFCRYPT_OBJS+=$(WOLFBOOT_LIB_WOLFSSL)/wolfcrypt/src/port/arm/armv8-chacha-asm_c.o endif + # wc_mldsa.c calls the NEON polynomial routines in this port file. + ifneq (,$(filter %/wolfcrypt/src/wc_mldsa.o,$(WOLFCRYPT_OBJS))) + WOLFCRYPT_OBJS+=$(WOLFBOOT_LIB_WOLFSSL)/wolfcrypt/src/port/arm/armv8-mldsa-asm_c.o + endif endif endif # --------------------------------------------------------------------------- From 7c5cfa973e34e46b507a965b071bf2461dc55947 Mon Sep 17 00:00:00 2001 From: Aidan Garske Date: Wed, 25 Nov 2026 15:14:07 -0800 Subject: [PATCH 4/4] Raise footprint limits to the sizes measured with the bumped wolfSSL --- tools/test.mk | 46 ++++++++++++++++++++++++---------------------- 1 file changed, 24 insertions(+), 22 deletions(-) diff --git a/tools/test.mk b/tools/test.mk index 61e77ba988..0040973a02 100644 --- a/tools/test.mk +++ b/tools/test.mk @@ -1332,52 +1332,54 @@ test-size-all: # version check added to that resume. # Re-measured 2026-10-28: every configuration grew 28-40B from the # last-sector erase fix. - make test-size SIGN=NONE LIMIT=5352 NO_ARM_ASM=1 + # Re-measured 2026-11-25 after the lib/wolfssl bump to c81176ab7: every + # configuration grew 84-328B from SHA-2 scratch wiping and Ed25519 key checks. + make test-size SIGN=NONE LIMIT=5436 NO_ARM_ASM=1 make keysclean - make test-size SIGN=ED25519 LIMIT=12508 NO_ARM_ASM=1 + make test-size SIGN=ED25519 LIMIT=12836 NO_ARM_ASM=1 make keysclean - make test-size SIGN=ECC256 LIMIT=19224 NO_ARM_ASM=1 + make test-size SIGN=ECC256 LIMIT=19348 NO_ARM_ASM=1 make clean - make test-size SIGN=ECC256 NO_ASM=1 LIMIT=14268 NO_ARM_ASM=1 + make test-size SIGN=ECC256 NO_ASM=1 LIMIT=14488 NO_ARM_ASM=1 make keysclean - make test-size SIGN=RSA2048 LIMIT=12060 NO_ARM_ASM=1 + make test-size SIGN=RSA2048 LIMIT=12188 NO_ARM_ASM=1 make clean - make test-size SIGN=RSA2048 NO_ASM=1 LIMIT=12616 NO_ARM_ASM=1 + make test-size SIGN=RSA2048 NO_ASM=1 LIMIT=12744 NO_ARM_ASM=1 make keysclean - make test-size SIGN=RSA4096 LIMIT=12360 NO_ARM_ASM=1 + make test-size SIGN=RSA4096 LIMIT=12488 NO_ARM_ASM=1 make clean - make test-size SIGN=RSA4096 NO_ASM=1 LIMIT=12908 NO_ARM_ASM=1 + make test-size SIGN=RSA4096 NO_ASM=1 LIMIT=13036 NO_ARM_ASM=1 make keysclean - make test-size SIGN=ECC384 LIMIT=19908 NO_ARM_ASM=1 + make test-size SIGN=ECC384 LIMIT=20036 NO_ARM_ASM=1 make clean - make test-size SIGN=ECC384 NO_ASM=1 LIMIT=15624 NO_ARM_ASM=1 + make test-size SIGN=ECC384 NO_ASM=1 LIMIT=15896 NO_ARM_ASM=1 make keysclean - make test-size SIGN=ED448 LIMIT=14520 NO_ARM_ASM=1 + make test-size SIGN=ED448 LIMIT=14768 NO_ARM_ASM=1 make keysclean - make test-size SIGN=RSA3072 LIMIT=12200 NO_ARM_ASM=1 + make test-size SIGN=RSA3072 LIMIT=12328 NO_ARM_ASM=1 make clean - make test-size SIGN=RSA3072 NO_ASM=1 LIMIT=12728 NO_ARM_ASM=1 + make test-size SIGN=RSA3072 NO_ASM=1 LIMIT=12856 NO_ARM_ASM=1 make keysclean - make test-size SIGN=RSAPSS2048 LIMIT=14052 NO_ARM_ASM=1 + make test-size SIGN=RSAPSS2048 LIMIT=14228 NO_ARM_ASM=1 make clean - make test-size SIGN=RSAPSS2048 NO_ASM=1 LIMIT=14608 NO_ARM_ASM=1 + make test-size SIGN=RSAPSS2048 NO_ASM=1 LIMIT=14784 NO_ARM_ASM=1 make keysclean - make test-size SIGN=RSAPSS3072 LIMIT=14216 NO_ARM_ASM=1 + make test-size SIGN=RSAPSS3072 LIMIT=14392 NO_ARM_ASM=1 make clean - make test-size SIGN=RSAPSS3072 NO_ASM=1 LIMIT=14744 NO_ARM_ASM=1 + make test-size SIGN=RSAPSS3072 NO_ASM=1 LIMIT=14920 NO_ARM_ASM=1 make keysclean - make test-size SIGN=RSAPSS4096 LIMIT=14388 NO_ARM_ASM=1 + make test-size SIGN=RSAPSS4096 LIMIT=14564 NO_ARM_ASM=1 make clean - make test-size SIGN=RSAPSS4096 NO_ASM=1 LIMIT=14936 NO_ARM_ASM=1 + make test-size SIGN=RSAPSS4096 NO_ASM=1 LIMIT=15112 NO_ARM_ASM=1 make keysclean make test-size SIGN=LMS LMS_LEVELS=2 LMS_HEIGHT=5 LMS_WINTERNITZ=8 \ WOLFBOOT_SMALL_STACK=0 IMAGE_SIGNATURE_SIZE=2644 \ - IMAGE_HEADER_SIZE?=5288 LIMIT=8364 NO_ARM_ASM=1 + IMAGE_HEADER_SIZE?=5288 LIMIT=8448 NO_ARM_ASM=1 make keysclean make test-size SIGN=XMSS XMSS_PARAMS='XMSS-SHA2_10_256' \ IMAGE_SIGNATURE_SIZE=2500 IMAGE_HEADER_SIZE?=4096 \ - LIMIT=9016 NO_ARM_ASM=1 + LIMIT=9120 NO_ARM_ASM=1 make keysclean make clean - make test-size SIGN=ML_DSA ML_DSA_LEVEL=2 LIMIT=19930 \ + make test-size SIGN=ML_DSA ML_DSA_LEVEL=2 LIMIT=20170 \ IMAGE_SIGNATURE_SIZE=2420 IMAGE_HEADER_SIZE?=8192