mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2025-07-30 18:57:27 +02:00
Fix for wolfCrypt test with custom curves without Brainpool. Tested all changes on NXP K82 LTC.
This commit is contained in:
@ -22873,6 +22873,7 @@ static int ecc_test_custom_curves(WC_RNG* rng)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* test use of custom curve - using BRAINPOOLP256R1 for test */
|
/* test use of custom curve - using BRAINPOOLP256R1 for test */
|
||||||
|
#ifdef HAVE_ECC_BRAINPOOL
|
||||||
#ifndef WOLFSSL_ECC_CURVE_STATIC
|
#ifndef WOLFSSL_ECC_CURVE_STATIC
|
||||||
WOLFSSL_SMALL_STACK_STATIC const ecc_oid_t ecc_oid_brainpoolp256r1[] = {
|
WOLFSSL_SMALL_STACK_STATIC const ecc_oid_t ecc_oid_brainpoolp256r1[] = {
|
||||||
0x2B,0x24,0x03,0x03,0x02,0x08,0x01,0x01,0x07
|
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 */
|
ecc_oid_brainpoolp256r1_sum, /* oid sum */
|
||||||
1, /* cofactor */
|
1, /* cofactor */
|
||||||
};
|
};
|
||||||
|
#endif /* HAVE_ECC_BRAINPOOL */
|
||||||
|
|
||||||
#ifdef WOLFSSL_SMALL_STACK
|
#ifdef WOLFSSL_SMALL_STACK
|
||||||
if (! key) {
|
if (! key) {
|
||||||
@ -22912,14 +22914,16 @@ static int ecc_test_custom_curves(WC_RNG* rng)
|
|||||||
|
|
||||||
XMEMSET(key, 0, sizeof *key);
|
XMEMSET(key, 0, sizeof *key);
|
||||||
|
|
||||||
|
#ifdef HAVE_ECC_BRAINPOOL
|
||||||
ret = ecc_test_curve_size(rng, 0, ECC_TEST_VERIFY_COUNT, ECC_CURVE_DEF,
|
ret = ecc_test_curve_size(rng, 0, ECC_TEST_VERIFY_COUNT, ECC_CURVE_DEF,
|
||||||
&ecc_dp_brainpool256r1);
|
&ecc_dp_brainpool256r1);
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
printf("ECC test for custom curve failed! %d\n", ret);
|
printf("ECC test for custom curve failed! %d\n", ret);
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(HAVE_ECC_BRAINPOOL) || defined(HAVE_ECC_KOBLITZ)
|
#if defined(HAVE_ECC_BRAINPOOL) || defined(HAVE_ECC_KOBLITZ)
|
||||||
{
|
{
|
||||||
int curve_id;
|
int curve_id;
|
||||||
#ifdef HAVE_ECC_BRAINPOOL
|
#ifdef HAVE_ECC_BRAINPOOL
|
||||||
@ -22934,7 +22938,7 @@ static int ecc_test_custom_curves(WC_RNG* rng)
|
|||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
ret = wc_ecc_init_ex(key, HEAP_HINT, devId);
|
ret = wc_ecc_init_ex(key, HEAP_HINT, devId);
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
@ -22959,6 +22963,8 @@ static int ecc_test_custom_curves(WC_RNG* rng)
|
|||||||
wc_ecc_free(key);
|
wc_ecc_free(key);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
(void)rng;
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
#endif /* WOLFSSL_CUSTOM_CURVES */
|
#endif /* WOLFSSL_CUSTOM_CURVES */
|
||||||
|
Reference in New Issue
Block a user