Merge pull request #10739 from JacobBarthelmeh/test

fix for nightly memory allocation test cases with LMS
This commit is contained in:
Daniel Pouzzner
2026-07-03 00:44:29 -05:00
committed by GitHub
+15 -2
View File
@@ -118,7 +118,9 @@ int test_wc_LmsKey_sign_verify(void)
int i;
int numSigs = 5;
/* Zero so cleanup is safe if an early alloc failure skips init. */
XMEMSET(&key, 0, sizeof(key));
XMEMSET(&rng, 0, sizeof(rng));
ExpectIntEQ(wc_InitRng(&rng), 0);
@@ -174,8 +176,10 @@ int test_wc_LmsKey_reload_cache(void)
/* Sign 33 times to advance q past the 32-entry cache window. */
int preSigs = 33;
/* Zero so cleanup is safe if an early alloc failure skips init. */
XMEMSET(&key, 0, sizeof(key));
XMEMSET(&vkey, 0, sizeof(vkey));
XMEMSET(&rng, 0, sizeof(rng));
ExpectIntEQ(wc_InitRng(&rng), 0);
@@ -861,8 +865,9 @@ static int rfc9802_gen_chain(void* caKey, int caKeyType, int caSigType,
ExpectNotNull(caDer = (byte*)XMALLOC(derCap, NULL, DYNAMIC_TYPE_TMP_BUFFER));
ExpectNotNull(leafDer = (byte*)XMALLOC(derCap, NULL,
DYNAMIC_TYPE_TMP_BUFFER));
ExpectIntEQ(wc_ecc_init(&leafKey), 0);
leafKeyInit = 1;
if (wc_ecc_init(&leafKey) == 0) /* only flag for free if init succeeded */
leafKeyInit = 1;
ExpectIntEQ(leafKeyInit, 1);
ExpectIntEQ(wc_ecc_make_key(rng, 32, &leafKey), 0);
/* Self-signed CA root. */
@@ -972,6 +977,10 @@ int test_rfc9802_lms_x509_gen(void)
LmsKey key;
WC_RNG rng;
/* Zero so cleanup is safe if an early alloc failure skips init. */
XMEMSET(&key, 0, sizeof(key));
XMEMSET(&rng, 0, sizeof(rng));
ExpectIntEQ(wc_InitRng(&rng), 0);
/* Single-level LMS (L1-H5-W8). */
@@ -1177,6 +1186,10 @@ int test_rfc9802_xmss_x509_gen(void)
XmssKey key;
WC_RNG rng;
/* Zero so cleanup is safe if an early alloc failure skips init. */
XMEMSET(&key, 0, sizeof(key));
XMEMSET(&rng, 0, sizeof(rng));
ExpectIntEQ(wc_InitRng(&rng), 0);
/* Single-tree XMSS. */