From d297a06c25dd7df0a08054ebc52064d52bc5a402 Mon Sep 17 00:00:00 2001 From: David Garske Date: Tue, 19 Oct 2021 10:22:07 -0700 Subject: [PATCH] Fix for wolfCrypt test with custom curves without Brainpool. Tested all changes on NXP K82 LTC. --- wolfcrypt/test/test.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/wolfcrypt/test/test.c b/wolfcrypt/test/test.c index 41bea4efc..f27f01cd3 100644 --- a/wolfcrypt/test/test.c +++ b/wolfcrypt/test/test.c @@ -22873,6 +22873,7 @@ static int ecc_test_custom_curves(WC_RNG* rng) #endif /* test use of custom curve - using BRAINPOOLP256R1 for test */ +#ifdef HAVE_ECC_BRAINPOOL #ifndef WOLFSSL_ECC_CURVE_STATIC WOLFSSL_SMALL_STACK_STATIC const ecc_oid_t ecc_oid_brainpoolp256r1[] = { 0x2B,0x24,0x03,0x03,0x02,0x08,0x01,0x01,0x07 @@ -22902,6 +22903,7 @@ static int ecc_test_custom_curves(WC_RNG* rng) ecc_oid_brainpoolp256r1_sum, /* oid sum */ 1, /* cofactor */ }; +#endif /* HAVE_ECC_BRAINPOOL */ #ifdef WOLFSSL_SMALL_STACK if (! key) { @@ -22912,14 +22914,16 @@ static int ecc_test_custom_curves(WC_RNG* rng) XMEMSET(key, 0, sizeof *key); +#ifdef HAVE_ECC_BRAINPOOL ret = ecc_test_curve_size(rng, 0, ECC_TEST_VERIFY_COUNT, ECC_CURVE_DEF, &ecc_dp_brainpool256r1); if (ret != 0) { printf("ECC test for custom curve failed! %d\n", ret); goto done; } +#endif - #if defined(HAVE_ECC_BRAINPOOL) || defined(HAVE_ECC_KOBLITZ) +#if defined(HAVE_ECC_BRAINPOOL) || defined(HAVE_ECC_KOBLITZ) { int curve_id; #ifdef HAVE_ECC_BRAINPOOL @@ -22934,7 +22938,7 @@ static int ecc_test_custom_curves(WC_RNG* rng) goto done; } } - #endif +#endif ret = wc_ecc_init_ex(key, HEAP_HINT, devId); if (ret != 0) { @@ -22959,6 +22963,8 @@ static int ecc_test_custom_curves(WC_RNG* rng) wc_ecc_free(key); #endif + (void)rng; + return ret; } #endif /* WOLFSSL_CUSTOM_CURVES */