From 6ae38f1b910210ff185b19befc60c9d927de0333 Mon Sep 17 00:00:00 2001 From: Ruby Martin Date: Mon, 9 Mar 2026 11:38:12 -0600 Subject: [PATCH 1/4] move unused variable suppression to top of exit_rsa label --- wolfcrypt/test/test.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/wolfcrypt/test/test.c b/wolfcrypt/test/test.c index 6ee466ef02..f76a7dec8f 100644 --- a/wolfcrypt/test/test.c +++ b/wolfcrypt/test/test.c @@ -25720,6 +25720,18 @@ WOLFSSL_TEST_SUBROUTINE wc_test_ret_t rsa_test(void) exit_rsa: + (void)res; + (void)bytes; + (void)idx; + (void)in; + (void)out; + (void)plain; + (void)idx; + (void)inStr; + (void)inLen; + (void)outSz; + (void)plainSz; + #if !defined(WOLFSSL_NO_MALLOC) XFREE(der, HEAP_HINT, DYNAMIC_TYPE_TMP_BUFFER); #if defined(WOLFSSL_CERT_REQ) @@ -25748,18 +25760,6 @@ exit_rsa: WC_FREE_VAR(out, HEAP_HINT); WC_FREE_VAR(plain, HEAP_HINT); - (void)res; - (void)bytes; - (void)idx; - (void)in; - (void)out; - (void)plain; - (void)idx; - (void)inStr; - (void)inLen; - (void)outSz; - (void)plainSz; - /* ret can be greater then 0 with certgen but all negative values should * be returned and treated as an error */ if (ret >= 0) { From 133f53f03dc64785acdfa6ab3d0b4401948b0648 Mon Sep 17 00:00:00 2001 From: Ruby Martin Date: Mon, 9 Mar 2026 11:39:21 -0600 Subject: [PATCH 2/4] replace sizeof with MAX_ECIES_TEST_SZ --- wolfcrypt/test/test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wolfcrypt/test/test.c b/wolfcrypt/test/test.c index f76a7dec8f..efc67b3eb5 100644 --- a/wolfcrypt/test/test.c +++ b/wolfcrypt/test/test.c @@ -37576,7 +37576,7 @@ static wc_test_ret_t ecc_ctx_kdf_salt_test(WC_RNG* rng, ecc_key* a, ecc_key* b) } XMEMSET(plaintext, 0, MAX_ECIES_TEST_SZ); - XSTRLCPY((char *)plaintext, message, sizeof plaintext); + XSTRLCPY((char *)plaintext, message, MAX_ECIES_TEST_SZ); plaintextLen = (((word32)XSTRLEN(message) + WC_AES_BLOCK_SIZE - 1) / WC_AES_BLOCK_SIZE) * WC_AES_BLOCK_SIZE; From ba39aacf20e1defd2f04cf977376e5d7e780c162 Mon Sep 17 00:00:00 2001 From: Ruby Martin Date: Mon, 9 Mar 2026 11:48:39 -0600 Subject: [PATCH 3/4] use ERROR_OUT when ret != 0 instead of returning --- wolfcrypt/test/test.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/wolfcrypt/test/test.c b/wolfcrypt/test/test.c index efc67b3eb5..622cd1e718 100644 --- a/wolfcrypt/test/test.c +++ b/wolfcrypt/test/test.c @@ -12512,7 +12512,7 @@ EVP_TEST_END: ret = EVP_test(wolfSSL_EVP_aes_128_cfb8(), key1, iv, msg1, sizeof(msg1), cipher1, sizeof(cipher1)); if (ret != 0) { - return ret; + ERROR_OUT(ret, out); } #endif ret = wc_AesSetKey(enc, key1, WC_AES_BLOCK_SIZE, iv, AES_ENCRYPTION); @@ -12559,7 +12559,7 @@ EVP_TEST_END: ret = EVP_test(wolfSSL_EVP_aes_192_cfb8(), key2, iv2, msg2, sizeof(msg2), cipher2, sizeof(msg2)); if (ret != 0) { - return ret; + ERROR_OUT(ret, out); } #endif From 66caf5ad5542b7cc7fb4b4e266b77616df0b4357 Mon Sep 17 00:00:00 2001 From: Ruby Martin Date: Mon, 9 Mar 2026 13:03:54 -0600 Subject: [PATCH 4/4] free enc and dec before returning MEMORY_E --- wolfcrypt/test/test.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/wolfcrypt/test/test.c b/wolfcrypt/test/test.c index 622cd1e718..c42ff7cb60 100644 --- a/wolfcrypt/test/test.c +++ b/wolfcrypt/test/test.c @@ -28242,8 +28242,11 @@ static wc_test_ret_t openssl_aes_test(void) int num = 0; #if defined(WOLFSSL_SMALL_STACK) && !defined(WOLFSSL_NO_MALLOC) - if ((enc == NULL) || (dec == NULL)) + if ((enc == NULL) || (dec == NULL)) { + XFREE(enc, HEAP_HINT, DYNAMIC_TYPE_AES); + XFREE(dec, HEAP_HINT, DYNAMIC_TYPE_AES); return MEMORY_E; + } #endif XMEMCPY(iv, setIv, sizeof(setIv));