diff --git a/examples/client/client.c b/examples/client/client.c index 66b20dd29..8efa4ec49 100644 --- a/examples/client/client.c +++ b/examples/client/client.c @@ -248,7 +248,7 @@ static void SetKeyShare(WOLFSSL* ssl, int onlyKeyShare, int useX25519) #endif { #ifdef HAVE_ECC - #if defined(HAVE_ECC256) || defined(HAVE_ALL_CURVES) + #if !defined(NO_ECC256) || defined(HAVE_ALL_CURVES) groups[count++] = WOLFSSL_ECC_SECP256R1; if (wolfSSL_UseKeyShare(ssl, WOLFSSL_ECC_SECP256R1) != WOLFSSL_SUCCESS) { @@ -2582,7 +2582,7 @@ THREAD_RETURN WOLFSSL_THREAD client_test(void* args) } #endif #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) != WOLFSSL_SUCCESS) { err_sys("unable to use curve secp256r1"); diff --git a/examples/server/server.c b/examples/server/server.c index e4334d5f0..ea8f06743 100644 --- a/examples/server/server.c +++ b/examples/server/server.c @@ -200,7 +200,7 @@ static int TestEmbedSendTo(WOLFSSL* ssl, char *buf, int sz, void *ctx) if (dtlsCtx->failOnce) { word32 seq = 0; - + if (PeekSeq(buf, &seq) && seq == dtlsCtx->blockSeq) { dtlsCtx->failOnce = 0; WOLFSSL_MSG("Forcing WANT_WRITE"); @@ -604,7 +604,7 @@ static const char* server_usage_msg[][49] = { #ifdef WOLFSSL_SEND_HRR_COOKIE "-J Server sends Cookie Extension containing state\n", /* 45 */ #endif -#endif /* WOLFSSL_TLS13 */ +#endif /* WOLFSSL_TLS13 */ #ifdef WOLFSSL_EARLY_DATA "-0 Early data read from client (0-RTT handshake)\n", /* 46 */ #endif @@ -721,7 +721,7 @@ static const char* server_usage_msg[][49] = { #ifdef WOLFSSL_SEND_HRR_COOKIE "-J サーバーの状態を含むTLS Cookie 拡張を送信する\n", /* 45 */ #endif -#endif /* WOLFSSL_TLS13 */ +#endif /* WOLFSSL_TLS13 */ #ifdef WOLFSSL_EARLY_DATA "-0 クライアントからの Early Data 読み取り" "(0-RTTハンドシェイク)\n", /* 46 */ @@ -744,7 +744,7 @@ static void Usage(void) int msgId = 0; const char** msg = server_usage_msg[lng_index]; - printf("%s%s%s", "server ", LIBWOLFSSL_VERSION_STRING, + printf("%s%s%s", "server ", LIBWOLFSSL_VERSION_STRING, msg[msgId]); printf("%s", msg[++msgId]); /* ? */ printf("%s %d\n", msg[++msgId], wolfSSLPort); /* -p */ @@ -1948,7 +1948,7 @@ THREAD_RETURN WOLFSSL_THREAD server_test(void* args) else { #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 }; if (wolfSSL_UseKeyShare(ssl, WOLFSSL_ECC_SECP256R1) diff --git a/wolfcrypt/src/ecc.c b/wolfcrypt/src/ecc.c index f9e9aa740..b14dda89f 100644 --- a/wolfcrypt/src/ecc.c +++ b/wolfcrypt/src/ecc.c @@ -3395,6 +3395,17 @@ int wc_ecc_get_curve_id_from_oid(const byte* oid, word32 len) 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) static WC_INLINE int wc_ecc_alloc_mpint(ecc_key* key, mp_int** mp) diff --git a/wolfssl/wolfcrypt/ecc.h b/wolfssl/wolfcrypt/ecc.h index 9304cdb24..6445f9dbf 100644 --- a/wolfssl/wolfcrypt/ecc.h +++ b/wolfssl/wolfcrypt/ecc.h @@ -528,6 +528,8 @@ int wc_ecc_get_curve_id_from_dp_params(const ecc_set_type* dp); WOLFSSL_API 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 ecc_point* wc_ecc_new_point(void); WOLFSSL_API