Skip to content

Commit f1fff73

Browse files
douzzerdanielinux
authored andcommitted
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.
1 parent 20ed869 commit f1fff73

3 files changed

Lines changed: 3 additions & 2 deletions

File tree

tests/api.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38112,7 +38112,7 @@ static int rfc9802_verify_one_cert(const char* path, word32 expectedKeyOID,
3811238112
* its bytes lie between (certBegin + outerSeqHeader) and sigIndex.
3811338113
* Picking the midpoint ensures we're inside TBS regardless of the
3811438114
* fixture's DN / extensions layout. */
38115-
if (tampered != NULL && sigIndex > certBegin + 8u) {
38115+
if (tampered != NULL && sigIndex > certBegin + 8U) {
3811638116
word32 midTbs = certBegin + 8 + ((sigIndex - (certBegin + 8)) / 2);
3811738117
XMEMCPY(tampered, buf, (size_t)bytes);
3811838118
tampered[midTbs] ^= 0x01;

tests/api/test_mldsa.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3241,9 +3241,9 @@ static int dilithium_oneasymkey_version_check(int level)
32413241
ExpectIntEQ(test_pkcs8_get_version_byte(ref, (word32)refSz), 1);
32423242

32433243
idx = 0;
3244+
PRIVATE_KEY_UNLOCK();
32443245
ExpectIntEQ(wc_Dilithium_PrivateKeyDecode(ref, &idx, &key2,
32453246
(word32)refSz), 0);
3246-
PRIVATE_KEY_UNLOCK();
32473247
ExpectIntEQ(rtSz = wc_Dilithium_KeyToDer(&key2, rt,
32483248
DILITHIUM_MAX_DER_SIZE), refSz);
32493249
PRIVATE_KEY_LOCK();

wolfcrypt/test/test.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36887,6 +36887,7 @@ static wc_test_ret_t ecc_test_curve_size(WC_RNG* rng, int keySize, int testVerif
3688736887
}
3688836888

3688936889
x = ECC_SIG_SIZE;
36890+
XMEMSET(sig, 0, ECC_SIG_SIZE);
3689036891
do {
3689136892
#if defined(WOLFSSL_ASYNC_CRYPT)
3689236893
ret = wc_AsyncWait(ret, &userA->asyncDev, WC_ASYNC_FLAG_CALL_AGAIN);

0 commit comments

Comments
 (0)