From 85bcf971575f90262a267612227a7c691de19852 Mon Sep 17 00:00:00 2001 From: Ruby Martin Date: Tue, 27 Oct 2026 11:51:11 -0600 Subject: [PATCH 1/4] Remove unreachable CallbackTypeEnd switch case in CRL ext-callback tests --- tests/api/test_certman.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/tests/api/test_certman.c b/tests/api/test_certman.c index bd24a014d2e..4975154f763 100644 --- a/tests/api/test_certman.c +++ b/tests/api/test_certman.c @@ -3892,7 +3892,6 @@ int test_wolfSSL_CRL_unknown_ext_cb_rescues_critical_entry_ext(void) crl_unk_ext_cb_accept32, &ctx), WOLFSSL_SUCCESS); break; - case CallbackTypeEnd: default: /* Not reachable: the loop bound excludes CallbackTypeEnd. */ ExpectFail(); @@ -3964,7 +3963,6 @@ int test_wolfSSL_CRL_unknown_ext_cb_rescues_critical_crl_ext(void) crl_unk_ext_cb_accept32, &ctx), WOLFSSL_SUCCESS); break; - case CallbackTypeEnd: default: /* Not reachable: the loop bound excludes CallbackTypeEnd. */ ExpectFail(); @@ -4006,7 +4004,6 @@ int test_wolfSSL_CRL_unknown_ext_cb_rescues_critical_crl_ext(void) crl_unk_ext_cb_reject32, &ctx), WOLFSSL_SUCCESS); break; - case CallbackTypeEnd: default: /* Not reachable: the loop bound excludes CallbackTypeEnd. */ ExpectFail(); @@ -4067,7 +4064,6 @@ int test_wolfSSL_CRL_unknown_ext_cb_positive_return_fails_load(void) crl_unk_ext_cb_reject_positive32, &ctx), WOLFSSL_SUCCESS); break; - case CallbackTypeEnd: default: /* Not reachable: the loop bound excludes CallbackTypeEnd. */ ExpectFail(); @@ -4144,7 +4140,6 @@ int test_wolfSSL_CRL_unknown_ext_cb_noctx(void) crl_unk_ext_cb_noctx_accept32), WOLFSSL_SUCCESS); break; - case CallbackTypeEnd: default: /* Not reachable: the loop bound excludes CallbackTypeEnd. */ ExpectFail(); @@ -4185,7 +4180,6 @@ int test_wolfSSL_CRL_unknown_ext_cb_noctx(void) crl_unk_ext_cb_noctx_reject32), WOLFSSL_SUCCESS); break; - case CallbackTypeEnd: default: /* Not reachable: the loop bound excludes CallbackTypeEnd. */ ExpectFail(); From c972c2b57b61395df51f0e6fe28b9853187ce2f7 Mon Sep 17 00:00:00 2001 From: Ruby Martin Date: Tue, 27 Oct 2026 11:51:14 -0600 Subject: [PATCH 2/4] Drop unreachable ret-capture around prim cleanup in rng_drbg_rbgc_test prim_inited only stays set after an ERROR_OUT already made ret nonzero. --- wolfcrypt/test/test.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/wolfcrypt/test/test.c b/wolfcrypt/test/test.c index 270f8b4e0b4..26456932441 100644 --- a/wolfcrypt/test/test.c +++ b/wolfcrypt/test/test.c @@ -35280,9 +35280,7 @@ WOLFSSL_TEST_SUBROUTINE wc_test_ret_t rng_drbg_rbgc_test(void) } #ifdef WC_RNG_HAVE_LOCK if (prim_inited) { - cleanup_ret = wc_FreeRng_PreLocked(&prim); - if ((cleanup_ret != 0) && (ret == 0)) - ret = WC_TEST_RET_ENC_EC(cleanup_ret); + (void)wc_FreeRng_PreLocked(&prim); } #endif if (extra_inited) { From fdd29f758e302281b1ae3919360e89a4797cf83e Mon Sep 17 00:00:00 2001 From: Ruby Martin Date: Tue, 27 Oct 2026 11:51:18 -0600 Subject: [PATCH 3/4] Zero-initialize Hmac before CryptoCb id test exercises it wc_HmacFree runs unconditionally even after an earlier assertion fails. --- tests/api/test_hmac.c | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/api/test_hmac.c b/tests/api/test_hmac.c index 6b7e46a6f57..b8acb39984c 100644 --- a/tests/api/test_hmac.c +++ b/tests/api/test_hmac.c @@ -1163,6 +1163,7 @@ int test_wc_HmacId_CryptoCb(void) byte mac[WC_SHA256_DIGEST_SIZE]; XMEMSET(&seen, 0, sizeof(seen)); + XMEMSET(&hmac, 0, sizeof(hmac)); ExpectIntEQ(wc_CryptoCb_RegisterDevice(TEST_HMAC_CRYPTOCB_DEVID, test_hmac_id_cb, &seen), 0); From b4adc43ce56966201ba5c185e81bc0a6546a06ad Mon Sep 17 00:00:00 2001 From: Ruby Martin Date: Tue, 27 Oct 2026 12:04:02 -0600 Subject: [PATCH 4/4] Remove unreachable root_held re-check in rng_lifecycle_test --- wolfcrypt/test/test.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/wolfcrypt/test/test.c b/wolfcrypt/test/test.c index 26456932441..899f1b5691e 100644 --- a/wolfcrypt/test/test.c +++ b/wolfcrypt/test/test.c @@ -37166,7 +37166,6 @@ WOLFSSL_TEST_SUBROUTINE wc_test_ret_t rng_lifecycle_test(void) } if (root_held) { int put_ret = wc_RNG_lock_put(root, 0); - root_held = 0; if ((api_ret == 0) && (put_ret != 0)) api_ret = put_ret; } @@ -37191,10 +37190,6 @@ WOLFSSL_TEST_SUBROUTINE wc_test_ret_t rng_lifecycle_test(void) } } } - if (root_held) { - (void)wc_FreeRng_PreLocked(root); - (void)wc_RNG_lock_put(root, 0); - } if (bank_inited) { int fini_ret = wc_rng_bank_fini(bank); if ((api_ret == 0) && (fini_ret != 0))