From ba505892af6f8b918ed77eab74085bdd9ba2823f Mon Sep 17 00:00:00 2001 From: Daniel Pouzzner Date: Fri, 8 May 2026 11:03:49 -0500 Subject: [PATCH] tests/api.c: fix readability-uppercase-literal-suffix in rfc9802_verify_one_cert(); tests/api/test_mldsa.c: fix misplaced PRIVATE_KEY_UNLOCK() in dilithium_oneasymkey_version_check(); wolfcrypt/test/test.c: fix valgrind-detected "Conditional jump or move depends on uninitialised value(s)" in ecc_test_curve_size() negative test on all-zeros digest. --- tests/api.c | 2 +- tests/api/test_mldsa.c | 2 +- wolfcrypt/test/test.c | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/api.c b/tests/api.c index c8df1a9f36..68f3aa0608 100644 --- a/tests/api.c +++ b/tests/api.c @@ -38112,7 +38112,7 @@ static int rfc9802_verify_one_cert(const char* path, word32 expectedKeyOID, * its bytes lie between (certBegin + outerSeqHeader) and sigIndex. * Picking the midpoint ensures we're inside TBS regardless of the * fixture's DN / extensions layout. */ - if (tampered != NULL && sigIndex > certBegin + 8u) { + if (tampered != NULL && sigIndex > certBegin + 8U) { word32 midTbs = certBegin + 8 + ((sigIndex - (certBegin + 8)) / 2); XMEMCPY(tampered, buf, (size_t)bytes); tampered[midTbs] ^= 0x01; diff --git a/tests/api/test_mldsa.c b/tests/api/test_mldsa.c index 592a0a28ce..7898e11079 100644 --- a/tests/api/test_mldsa.c +++ b/tests/api/test_mldsa.c @@ -3241,9 +3241,9 @@ static int dilithium_oneasymkey_version_check(int level) ExpectIntEQ(test_pkcs8_get_version_byte(ref, (word32)refSz), 1); idx = 0; + PRIVATE_KEY_UNLOCK(); ExpectIntEQ(wc_Dilithium_PrivateKeyDecode(ref, &idx, &key2, (word32)refSz), 0); - PRIVATE_KEY_UNLOCK(); ExpectIntEQ(rtSz = wc_Dilithium_KeyToDer(&key2, rt, DILITHIUM_MAX_DER_SIZE), refSz); PRIVATE_KEY_LOCK(); diff --git a/wolfcrypt/test/test.c b/wolfcrypt/test/test.c index 5b0834019e..6d3b7d4793 100644 --- a/wolfcrypt/test/test.c +++ b/wolfcrypt/test/test.c @@ -36887,6 +36887,7 @@ static wc_test_ret_t ecc_test_curve_size(WC_RNG* rng, int keySize, int testVerif } x = ECC_SIG_SIZE; + XMEMSET(sig, 0, ECC_SIG_SIZE); do { #if defined(WOLFSSL_ASYNC_CRYPT) ret = wc_AsyncWait(ret, &userA->asyncDev, WC_ASYNC_FLAG_CALL_AGAIN);