mirror of https://github.com/wolfSSL/wolfssl.git
Adds new `wc_ecc_get_curve_params` API for getting the `ecc_set_type` params for a curve index. Fix for example client and server using wrong macro for detecting ECC 256-bit enabled.
parent
c400c38588
commit
b4673344c0
|
@ -248,7 +248,7 @@ static void SetKeyShare(WOLFSSL* ssl, int onlyKeyShare, int useX25519)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
#ifdef HAVE_ECC
|
#ifdef HAVE_ECC
|
||||||
#if defined(HAVE_ECC256) || defined(HAVE_ALL_CURVES)
|
#if !defined(NO_ECC256) || defined(HAVE_ALL_CURVES)
|
||||||
groups[count++] = WOLFSSL_ECC_SECP256R1;
|
groups[count++] = WOLFSSL_ECC_SECP256R1;
|
||||||
if (wolfSSL_UseKeyShare(ssl, WOLFSSL_ECC_SECP256R1)
|
if (wolfSSL_UseKeyShare(ssl, WOLFSSL_ECC_SECP256R1)
|
||||||
!= WOLFSSL_SUCCESS) {
|
!= WOLFSSL_SUCCESS) {
|
||||||
|
@ -2582,7 +2582,7 @@ THREAD_RETURN WOLFSSL_THREAD client_test(void* args)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_ECC
|
#ifdef HAVE_ECC
|
||||||
#if defined(HAVE_ECC256) || defined(HAVE_ALL_CURVES)
|
#if !defined(NO_ECC256) || defined(HAVE_ALL_CURVES)
|
||||||
if (wolfSSL_UseKeyShare(ssl, WOLFSSL_ECC_SECP256R1)
|
if (wolfSSL_UseKeyShare(ssl, WOLFSSL_ECC_SECP256R1)
|
||||||
!= WOLFSSL_SUCCESS) {
|
!= WOLFSSL_SUCCESS) {
|
||||||
err_sys("unable to use curve secp256r1");
|
err_sys("unable to use curve secp256r1");
|
||||||
|
|
|
@ -1948,7 +1948,7 @@ THREAD_RETURN WOLFSSL_THREAD server_test(void* args)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
#ifdef HAVE_ECC
|
#ifdef HAVE_ECC
|
||||||
#if defined(HAVE_ECC256) || defined(HAVE_ALL_CURVES)
|
#if !defined(NO_ECC256) || defined(HAVE_ALL_CURVES)
|
||||||
int groups[1] = { WOLFSSL_ECC_SECP256R1 };
|
int groups[1] = { WOLFSSL_ECC_SECP256R1 };
|
||||||
|
|
||||||
if (wolfSSL_UseKeyShare(ssl, WOLFSSL_ECC_SECP256R1)
|
if (wolfSSL_UseKeyShare(ssl, WOLFSSL_ECC_SECP256R1)
|
||||||
|
|
|
@ -3395,6 +3395,17 @@ int wc_ecc_get_curve_id_from_oid(const byte* oid, word32 len)
|
||||||
return ecc_sets[curve_idx].id;
|
return ecc_sets[curve_idx].id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Get curve parameters using curve index */
|
||||||
|
const ecc_set_type* wc_ecc_get_curve_params(int curve_idx)
|
||||||
|
{
|
||||||
|
const ecc_set_type* ecc_set = NULL;
|
||||||
|
|
||||||
|
if (curve_idx >= 0 && curve_idx < (int)ECC_SET_COUNT) {
|
||||||
|
ecc_set = &ecc_sets[curve_idx];
|
||||||
|
}
|
||||||
|
return ecc_set;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#if defined(WOLFSSL_ASYNC_CRYPT) && defined(WC_ASYNC_ENABLE_ECC)
|
#if defined(WOLFSSL_ASYNC_CRYPT) && defined(WC_ASYNC_ENABLE_ECC)
|
||||||
static WC_INLINE int wc_ecc_alloc_mpint(ecc_key* key, mp_int** mp)
|
static WC_INLINE int wc_ecc_alloc_mpint(ecc_key* key, mp_int** mp)
|
||||||
|
|
|
@ -528,6 +528,8 @@ int wc_ecc_get_curve_id_from_dp_params(const ecc_set_type* dp);
|
||||||
WOLFSSL_API
|
WOLFSSL_API
|
||||||
int wc_ecc_get_curve_id_from_oid(const byte* oid, word32 len);
|
int wc_ecc_get_curve_id_from_oid(const byte* oid, word32 len);
|
||||||
|
|
||||||
|
WOLFSSL_API const ecc_set_type* wc_ecc_get_curve_params(int curve_idx);
|
||||||
|
|
||||||
WOLFSSL_API
|
WOLFSSL_API
|
||||||
ecc_point* wc_ecc_new_point(void);
|
ecc_point* wc_ecc_new_point(void);
|
||||||
WOLFSSL_API
|
WOLFSSL_API
|
||||||
|
|
Loading…
Reference in New Issue