mirror of https://github.com/wolfSSL/wolfssl.git
Merge pull request #5867 from anhu/dont_make_broken_key
For compatibility `EC_KEY_new_by_curve_name` check that we found curvepull/5869/head
commit
9cb19e36fe
9
src/pk.c
9
src/pk.c
|
@ -9168,12 +9168,19 @@ WOLFSSL_EC_KEY *wolfSSL_EC_KEY_new_by_curve_name(int nid)
|
|||
|
||||
if (eccEnum != -1) {
|
||||
/* search and set the corresponding internal curve idx */
|
||||
for (x = 0; ecc_sets[x].size != 0; x++)
|
||||
for (x = 0; ecc_sets[x].size != 0; x++) {
|
||||
if (ecc_sets[x].id == eccEnum) {
|
||||
key->group->curve_idx = x;
|
||||
key->group->curve_oid = ecc_sets[x].oidSum;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* if not found, we don't support this curve. */
|
||||
if (ecc_sets[x].size == 0) {
|
||||
wolfSSL_EC_KEY_free(key);
|
||||
key = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
return key;
|
||||
|
|
|
@ -46165,7 +46165,7 @@ static int test_wolfSSL_EC_KEY_print_fp(void)
|
|||
{
|
||||
int res = TEST_SKIPPED;
|
||||
#if defined(HAVE_ECC) && ((defined(HAVE_ECC224) && defined(HAVE_ECC256)) || \
|
||||
defined(HAVE_ALL_CURVES)) && ECC_MIN_KEY_SZ <= 256 && \
|
||||
defined(HAVE_ALL_CURVES)) && ECC_MIN_KEY_SZ <= 224 && \
|
||||
defined(OPENSSL_EXTRA) && defined(XFPRINTF) && !defined(NO_FILESYSTEM) && \
|
||||
!defined(NO_STDIO_FILESYSTEM)
|
||||
EC_KEY* key = NULL;
|
||||
|
|
Loading…
Reference in New Issue