Skip to content

Commit 9a2dc12

Browse files
author
Lealem Amedie
committed
Don't test SECP vectors when disabled in test.c
1 parent 6e572cc commit 9a2dc12

1 file changed

Lines changed: 17 additions & 7 deletions

File tree

wolfcrypt/test/test.c

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23391,6 +23391,10 @@ WOLFSSL_TEST_SUBROUTINE int hpke_test(void)
2339123391
#endif
2339223392
#define ECC_SIG_SIZE ECC_MAX_SIG_SIZE
2339323393

23394+
#ifdef NO_ECC_SECP
23395+
#define NO_ECC_VECTOR_TEST
23396+
#endif
23397+
2339423398
#ifndef NO_ECC_VECTOR_TEST
2339523399
#if (defined(HAVE_ECC192) || defined(HAVE_ECC224) ||\
2339623400
!defined(NO_ECC256) || defined(HAVE_ECC384) ||\
@@ -25839,8 +25843,9 @@ static int ecc_def_curve_test(WC_RNG *rng)
2583925843
#else
2584025844
ecc_key key[1];
2584125845
#endif
25842-
#if (defined(HAVE_ECC_KEY_IMPORT) && defined(HAVE_ECC_KEY_EXPORT)) || \
25843-
(defined(HAVE_ECC_KEY_IMPORT) && !defined(WOLFSSL_VALIDATE_ECC_IMPORT))
25846+
#if ((defined(HAVE_ECC_KEY_IMPORT) && defined(HAVE_ECC_KEY_EXPORT)) || \
25847+
(defined(HAVE_ECC_KEY_IMPORT) && !defined(WOLFSSL_VALIDATE_ECC_IMPORT))) \
25848+
&& !defined(NO_ECC_SECP)
2584425849
word32 idx = 0;
2584525850
#endif
2584625851

@@ -25891,8 +25896,9 @@ static int ecc_def_curve_test(WC_RNG *rng)
2589125896
(void)rng;
2589225897
#endif /* !WC_NO_RNG */
2589325898

25894-
#if (defined(HAVE_ECC_KEY_IMPORT) && defined(HAVE_ECC_KEY_EXPORT)) || \
25895-
(defined(HAVE_ECC_KEY_IMPORT) && !defined(WOLFSSL_VALIDATE_ECC_IMPORT))
25899+
#if ((defined(HAVE_ECC_KEY_IMPORT) && defined(HAVE_ECC_KEY_EXPORT)) || \
25900+
(defined(HAVE_ECC_KEY_IMPORT) && !defined(WOLFSSL_VALIDATE_ECC_IMPORT))) \
25901+
&& !defined(NO_ECC_SECP)
2589625902
/* Use test ECC key - ensure real private "d" exists */
2589725903
#ifdef USE_CERT_BUFFERS_256
2589825904
ret = wc_EccPrivateKeyDecode(ecc_key_der_256, &idx, key,
@@ -26496,7 +26502,8 @@ static int ecc_test_cert_gen(WC_RNG* rng)
2649626502
#endif /* WOLFSSL_CERT_GEN */
2649726503

2649826504
#if !defined(HAVE_FIPS) && !defined(HAVE_SELFTEST) && \
26499-
!defined(WOLFSSL_NO_MALLOC) && !defined(WOLF_CRYPTO_CB_ONLY_ECC)
26505+
!defined(WOLFSSL_NO_MALLOC) && !defined(WOLF_CRYPTO_CB_ONLY_ECC) && \
26506+
(!defined(NO_ECC_SECP) || defined(WOLFSSL_CUSTOM_CURVES))
2650026507
/* Test for the wc_ecc_key_new() and wc_ecc_key_free() functions. */
2650126508
static int ecc_test_allocator(WC_RNG* rng)
2650226509
{
@@ -27084,10 +27091,12 @@ WOLFSSL_TEST_SUBROUTINE int ecc_test(void)
2708427091
goto done;
2708527092
}
2708627093
#endif
27094+
#if !defined(NO_ECC_SECP) || defined(WOLFSSL_CUSTOM_CURVES)
2708727095
ret = ecc_def_curve_test(&rng);
2708827096
if (ret < 0) {
2708927097
goto done;
2709027098
}
27099+
#endif
2709127100
#endif /* !NO_ECC256 */
2709227101
#if (defined(HAVE_ECC320) || defined(HAVE_ALL_CURVES)) && ECC_MIN_KEY_SZ <= 320
2709327102
ret = ecc_test_curve(&rng, 40);
@@ -27166,7 +27175,7 @@ WOLFSSL_TEST_SUBROUTINE int ecc_test(void)
2716627175
#endif
2716727176
#if !defined(WOLFSSL_ATECC508A) && !defined(WOLFSSL_ATECC608A) && \
2716827177
!defined(WOLFSSL_STM32_PKA) && !defined(WOLFSSL_SILABS_SE_ACCEL) && \
27169-
!defined(WOLF_CRYPTO_CB_ONLY_ECC)
27178+
!defined(WOLF_CRYPTO_CB_ONLY_ECC) && !defined(NO_ECC_SECP)
2717027179
ret = ecc_test_make_pub(&rng);
2717127180
if (ret != 0) {
2717227181
printf("ecc_test_make_pub failed!: %d\n", ret);
@@ -27183,7 +27192,8 @@ WOLFSSL_TEST_SUBROUTINE int ecc_test(void)
2718327192
}
2718427193
#endif
2718527194
#if !defined(HAVE_FIPS) && !defined(HAVE_SELFTEST) && !defined(WOLFSSL_NO_MALLOC) && \
27186-
!defined(WOLF_CRYPTO_CB_ONLY_ECC)
27195+
!defined(WOLF_CRYPTO_CB_ONLY_ECC) && (!defined(NO_ECC_SECP) || \
27196+
defined(WOLFSSL_CUSTOM_CURVES))
2718727197
ret = ecc_test_allocator(&rng);
2718827198
if (ret != 0) {
2718927199
printf("ecc_test_allocator failed!: %d\n", ret);

0 commit comments

Comments
 (0)