Skip to content

Commit 2bbc3a0

Browse files
committed
wolfcrypt/test/test.c: fixes for --disable-sha256, --disable-hmac, --disable-rng, and FIPS gating on RSA-PSS.
1 parent 08f5c3e commit 2bbc3a0

1 file changed

Lines changed: 13 additions & 8 deletions

File tree

wolfcrypt/test/test.c

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -621,7 +621,7 @@ WOLFSSL_TEST_SUBROUTINE wc_test_ret_t tls12_kdf_test(void);
621621
WOLFSSL_TEST_SUBROUTINE wc_test_ret_t prf_test(void);
622622
#endif
623623
WOLFSSL_TEST_SUBROUTINE wc_test_ret_t sshkdf_test(void);
624-
#ifdef WOLFSSL_TLS13
624+
#if defined(WOLFSSL_TLS13) && !defined(NO_HMAC)
625625
WOLFSSL_TEST_SUBROUTINE wc_test_ret_t tls13_kdf_test(void);
626626
#endif
627627
WOLFSSL_TEST_SUBROUTINE wc_test_ret_t x963kdf_test(void);
@@ -1944,14 +1944,14 @@ options: [-s max_relative_stack_bytes] [-m max_relative_heap_memory_bytes]\n\
19441944
#endif /* WOLFSSL_HAVE_PRF && HAVE_HKDF && !NO_HMAC && */
19451945
/* WOLFSSL_BASE16 && !WOLFSSL_NO_TLS12 */
19461946

1947-
#ifdef WOLFSSL_TLS13
1947+
#if defined(WOLFSSL_TLS13) && !defined(NO_HMAC)
19481948
PRIVATE_KEY_UNLOCK();
19491949
if ( (ret = tls13_kdf_test()) != 0)
19501950
TEST_FAIL("TLSv1.3 KDF test failed!\n", ret);
19511951
else
19521952
TEST_PASS("TLSv1.3 KDF test passed!\n");
19531953
PRIVATE_KEY_LOCK();
1954-
#endif /* WOLFSSL_TLS13 */
1954+
#endif /* WOLFSSL_TLS13 && !NO_HMAC */
19551955

19561956
#if defined(HAVE_X963_KDF) && defined(HAVE_ECC)
19571957
if ( (ret = x963kdf_test()) != 0)
@@ -20769,7 +20769,9 @@ static wc_test_ret_t rsa_decode_test(RsaKey* keyPub)
2076920769
}
2077020770
#endif
2077120771

20772-
#if defined(WC_RSA_PSS) && !defined(HAVE_FIPS_VERSION) /* not supported with FIPSv1 */
20772+
#if defined(WC_RSA_PSS) && \
20773+
(!defined(HAVE_FIPS) || FIPS_VERSION_GE(5,0)) && \
20774+
!defined(WC_NO_RNG)
2077320775
/* Need to create known good signatures to test with this. */
2077420776
#if !defined(WOLFSSL_RSA_VERIFY_ONLY) && !defined(WOLFSSL_RSA_PUBLIC_ONLY) && \
2077520777
!defined(WOLF_CRYPTO_CB_ONLY_RSA)
@@ -21131,7 +21133,8 @@ static wc_test_ret_t rsa_pss_test(WC_RNG* rng, RsaKey* key)
2113121133
return ret;
2113221134
}
2113321135
#endif /* !WOLFSSL_RSA_VERIFY_ONLY && !WOLFSSL_RSA_PUBLIC_ONLY */
21134-
#endif
21136+
#endif /* WC_RSA_PSS && (!HAVE_FIPS || FIPS_VERSION_GE(5,0)) && !WC_NO_RNG */
21137+
2113521138

2113621139
#ifdef WC_RSA_NO_PADDING
2113721140
WOLFSSL_TEST_SUBROUTINE wc_test_ret_t rsa_no_pad_test(void)
@@ -23176,7 +23179,9 @@ WOLFSSL_TEST_SUBROUTINE wc_test_ret_t rsa_test(void)
2317623179
#endif /* WOLFSSL_CERT_REQ */
2317723180
#endif /* WOLFSSL_CERT_GEN */
2317823181

23179-
#if defined(WC_RSA_PSS) && !defined(HAVE_FIPS_VERSION) /* not supported with FIPSv1 */
23182+
#if defined(WC_RSA_PSS) && \
23183+
(!defined(HAVE_FIPS) || FIPS_VERSION_GE(5,0)) && \
23184+
!defined(WC_NO_RNG)
2318023185
/* Need to create known good signatures to test with this. */
2318123186
#if !defined(WOLFSSL_RSA_VERIFY_ONLY) && !defined(WOLFSSL_RSA_PUBLIC_ONLY) && \
2318223187
!defined(WOLF_CRYPTO_CB_ONLY_RSA)
@@ -28431,7 +28436,7 @@ WOLFSSL_TEST_SUBROUTINE wc_test_ret_t tls12_kdf_test(void)
2843128436
#endif /* WOLFSSL_HAVE_PRF && HAVE_HKDF && !NO_HMAC && */
2843228437
/* WOLFSSL_BASE16 && !WOLFSSL_NO_TLS12 */
2843328438

28434-
#ifdef WOLFSSL_TLS13
28439+
#if defined(WOLFSSL_TLS13) && !defined(NO_HMAC)
2843528440

2843628441
#define TLSV13_PSK_DHE_SZ 40
2843728442
typedef struct {
@@ -29127,7 +29132,7 @@ WOLFSSL_TEST_SUBROUTINE wc_test_ret_t tls13_kdf_test(void)
2912729132
return ret;
2912829133
}
2912929134

29130-
#endif /* WOLFSSL_TLS13 */
29135+
#endif /* WOLFSSL_TLS13 && !NO_HMAC */
2913129136

2913229137
static const int fiducial2 = WC_TEST_RET_LN; /* source code reference point --
2913329138
* see print_fiducials() below.

0 commit comments

Comments
 (0)