Skip to content

Commit 281c2a4

Browse files
committed
wolfcrypt/test/test.c: fix return code in pbkdf2_test(), add DEBUG_WOLFSSL gates on keysize report in ecc_test_curve(), and add missing PRIVATE_KEY_UNLOCK()s in cryptocb_test() for fips-dev coverage.
1 parent 6e0a901 commit 281c2a4

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

wolfcrypt/test/test.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24692,7 +24692,7 @@ WOLFSSL_TEST_SUBROUTINE wc_test_ret_t pbkdf2_test(void)
2469224692
salt, (int)sizeof(salt), iterations,
2469324693
kLen, WC_SHA256, HEAP_HINT, devId);
2469424694
if (ret != 0)
24695-
return ret;
24695+
return WC_TEST_RET_ENC_EC(ret);
2469624696

2469724697
if (XMEMCMP(derived, verify, sizeof(verify)) != 0)
2469824698
return WC_TEST_RET_ENC_NC;
@@ -28505,13 +28505,14 @@ static wc_test_ret_t ecc_test_curve(WC_RNG* rng, int keySize, int curve_id)
2850528505
WOLFSSL_MSG_EX("ecc_test_curve keySize = %d", keySize);
2850628506

2850728507
#if FIPS_VERSION3_GE(6,0,0)
28508+
#ifdef DEBUG_WOLFSSL
2850828509
printf("keySize is %d\n", keySize);
28510+
#endif
2850928511
if (keySize < WC_ECC_FIPS_GEN_MIN) {
2851028512
goto skip_A;
2851128513
}
2851228514
#endif
2851328515

28514-
2851528516
ret = ecc_test_curve_size(rng, keySize, ECC_TEST_VERIFY_COUNT, curve_id,
2851628517
NULL);
2851728518
if (ret < 0) {
@@ -50577,8 +50578,10 @@ WOLFSSL_TEST_SUBROUTINE wc_test_ret_t cryptocb_test(void)
5057750578
PRIVATE_KEY_LOCK();
5057850579
#endif
5057950580
#ifdef HAVE_ED25519
50581+
PRIVATE_KEY_UNLOCK();
5058050582
if (ret == 0)
5058150583
ret = ed25519_test();
50584+
PRIVATE_KEY_LOCK();
5058250585
#endif
5058350586
#ifdef HAVE_CURVE25519
5058450587
if (ret == 0)
@@ -50634,8 +50637,10 @@ WOLFSSL_TEST_SUBROUTINE wc_test_ret_t cryptocb_test(void)
5063450637
#endif
5063550638
#ifndef NO_PWDBASED
5063650639
#if defined(HAVE_PBKDF2) && !defined(NO_SHA256) && !defined(NO_HMAC)
50640+
PRIVATE_KEY_UNLOCK();
5063750641
if (ret == 0)
5063850642
ret = pbkdf2_test();
50643+
PRIVATE_KEY_LOCK();
5063950644
#endif
5064050645
#endif
5064150646
#if defined(WOLFSSL_CMAC) && !defined(NO_AES)

0 commit comments

Comments
 (0)