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");
|
||||||
|
|
|
@ -200,7 +200,7 @@ static int TestEmbedSendTo(WOLFSSL* ssl, char *buf, int sz, void *ctx)
|
||||||
|
|
||||||
if (dtlsCtx->failOnce) {
|
if (dtlsCtx->failOnce) {
|
||||||
word32 seq = 0;
|
word32 seq = 0;
|
||||||
|
|
||||||
if (PeekSeq(buf, &seq) && seq == dtlsCtx->blockSeq) {
|
if (PeekSeq(buf, &seq) && seq == dtlsCtx->blockSeq) {
|
||||||
dtlsCtx->failOnce = 0;
|
dtlsCtx->failOnce = 0;
|
||||||
WOLFSSL_MSG("Forcing WANT_WRITE");
|
WOLFSSL_MSG("Forcing WANT_WRITE");
|
||||||
|
@ -604,7 +604,7 @@ static const char* server_usage_msg[][49] = {
|
||||||
#ifdef WOLFSSL_SEND_HRR_COOKIE
|
#ifdef WOLFSSL_SEND_HRR_COOKIE
|
||||||
"-J Server sends Cookie Extension containing state\n", /* 45 */
|
"-J Server sends Cookie Extension containing state\n", /* 45 */
|
||||||
#endif
|
#endif
|
||||||
#endif /* WOLFSSL_TLS13 */
|
#endif /* WOLFSSL_TLS13 */
|
||||||
#ifdef WOLFSSL_EARLY_DATA
|
#ifdef WOLFSSL_EARLY_DATA
|
||||||
"-0 Early data read from client (0-RTT handshake)\n", /* 46 */
|
"-0 Early data read from client (0-RTT handshake)\n", /* 46 */
|
||||||
#endif
|
#endif
|
||||||
|
@ -721,7 +721,7 @@ static const char* server_usage_msg[][49] = {
|
||||||
#ifdef WOLFSSL_SEND_HRR_COOKIE
|
#ifdef WOLFSSL_SEND_HRR_COOKIE
|
||||||
"-J サーバーの状態を含むTLS Cookie 拡張を送信する\n", /* 45 */
|
"-J サーバーの状態を含むTLS Cookie 拡張を送信する\n", /* 45 */
|
||||||
#endif
|
#endif
|
||||||
#endif /* WOLFSSL_TLS13 */
|
#endif /* WOLFSSL_TLS13 */
|
||||||
#ifdef WOLFSSL_EARLY_DATA
|
#ifdef WOLFSSL_EARLY_DATA
|
||||||
"-0 クライアントからの Early Data 読み取り"
|
"-0 クライアントからの Early Data 読み取り"
|
||||||
"(0-RTTハンドシェイク)\n", /* 46 */
|
"(0-RTTハンドシェイク)\n", /* 46 */
|
||||||
|
@ -744,7 +744,7 @@ static void Usage(void)
|
||||||
int msgId = 0;
|
int msgId = 0;
|
||||||
const char** msg = server_usage_msg[lng_index];
|
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]);
|
msg[msgId]);
|
||||||
printf("%s", msg[++msgId]); /* ? */
|
printf("%s", msg[++msgId]); /* ? */
|
||||||
printf("%s %d\n", msg[++msgId], wolfSSLPort); /* -p */
|
printf("%s %d\n", msg[++msgId], wolfSSLPort); /* -p */
|
||||||
|
@ -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