mirror of https://github.com/wolfSSL/wolfssl.git
Added unit test for wc_ecc_get_curve_id_from_dp_params
parent
f8c9285b92
commit
6b51f2d5b2
52
tests/api.c
52
tests/api.c
|
@ -2107,7 +2107,7 @@ static THREAD_RETURN WOLFSSL_THREAD test_server_loop(void* args)
|
|||
if (cbf != NULL && cbf->ctx_ready != NULL) {
|
||||
cbf->ctx_ready(ctx);
|
||||
}
|
||||
|
||||
|
||||
while(count != loop_count) {
|
||||
ssl = wolfSSL_new(ctx);
|
||||
if (ssl == NULL) {
|
||||
|
@ -2125,7 +2125,7 @@ static THREAD_RETURN WOLFSSL_THREAD test_server_loop(void* args)
|
|||
"Please run from wolfSSL home dir");*/
|
||||
goto done;
|
||||
}
|
||||
|
||||
|
||||
#if !defined(NO_FILESYSTEM) && !defined(NO_DH)
|
||||
wolfSSL_SetTmpDH_file(ssl, dhParamFile, WOLFSSL_FILETYPE_PEM);
|
||||
#elif !defined(NO_DH)
|
||||
|
@ -2470,7 +2470,7 @@ static void test_client_reuse_WOLFSSLobj(void* args, void *cb, void* server_args
|
|||
if(wolfSSL_KeepHandshakeResources(ssl)) {
|
||||
/* err_sys("SSL_KeepHandshakeResources failed"); */
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
if (sharedCtx && wolfSSL_use_certificate_file(ssl, cliCertFile,
|
||||
WOLFSSL_FILETYPE_PEM) != WOLFSSL_SUCCESS) {
|
||||
/*err_sys("can't load client cert file, "
|
||||
|
@ -22701,6 +22701,48 @@ static void test_wc_ecc_get_curve_id_from_name(void)
|
|||
#endif /* HAVE_ECC */
|
||||
}
|
||||
|
||||
#if defined(OPENSSL_EXTRA)
|
||||
static void test_wc_ecc_get_curve_id_from_dp_params(void)
|
||||
{
|
||||
#ifdef HAVE_ECC
|
||||
int id;
|
||||
int curve_id;
|
||||
int ret = 0;
|
||||
WOLFSSL_EC_KEY *ecKey;
|
||||
ecc_key* key;
|
||||
const ecc_set_type* params;
|
||||
|
||||
printf(testingFmt, "wc_ecc_get_curve_id_from_dp_params");
|
||||
|
||||
#if !defined(NO_ECC256) && !defined(NO_ECC_SECP)
|
||||
id = wc_ecc_get_curve_id_from_name("SECP256R1");
|
||||
AssertIntEQ(id, ECC_SECP256R1);
|
||||
#endif
|
||||
|
||||
ecKey = wolfSSL_EC_KEY_new_by_curve_name(id);
|
||||
AssertNotNull(ecKey);
|
||||
|
||||
ret = wolfSSL_EC_KEY_generate_key(ecKey);
|
||||
|
||||
if (ret == 0) {
|
||||
/* normal test */
|
||||
key = (ecc_key*)ecKey->internal;
|
||||
params = key->dp;
|
||||
|
||||
curve_id = wc_ecc_get_curve_id_from_dp_params(params);
|
||||
AssertIntEQ(curve_id, id);
|
||||
}
|
||||
|
||||
/* invalid case, NULL input*/
|
||||
|
||||
id = wc_ecc_get_curve_id_from_dp_params(NULL);
|
||||
AssertIntEQ(id, BAD_FUNC_ARG);
|
||||
|
||||
printf(resultFmt, passed);
|
||||
#endif /* HAVE_ECC */
|
||||
}
|
||||
#endif /* OPENSSL_EXTRA */
|
||||
|
||||
static void test_wc_ecc_get_curve_id_from_params(void)
|
||||
{
|
||||
#ifdef HAVE_ECC
|
||||
|
@ -24344,7 +24386,7 @@ void ApiTest(void)
|
|||
test_wolfSSL_read_write();
|
||||
#if defined(OPENSSL_EXTRA) && !defined(NO_SESSION_CACHE) && !defined(WOLFSSL_TLS13)
|
||||
test_wolfSSL_reuse_WOLFSSLobj();
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
test_wolfSSL_dtls_export();
|
||||
AssertIntEQ(test_wolfSSL_SetMinVersion(), WOLFSSL_SUCCESS);
|
||||
|
@ -24501,7 +24543,6 @@ void ApiTest(void)
|
|||
test_wc_ecc_get_curve_size_from_name();
|
||||
test_wc_ecc_get_curve_id_from_name();
|
||||
test_wc_ecc_get_curve_id_from_params();
|
||||
|
||||
#ifdef WOLFSSL_TLS13
|
||||
/* TLS v1.3 API tests */
|
||||
test_tls13_apis();
|
||||
|
@ -24648,6 +24689,7 @@ void ApiTest(void)
|
|||
test_wolfSSL_EVP_get_cipherbynid();
|
||||
test_wolfSSL_EC();
|
||||
test_wolfSSL_ECDSA_SIG();
|
||||
test_wc_ecc_get_curve_id_from_dp_params();
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_HASHDRBG
|
||||
|
|
|
@ -155,10 +155,12 @@
|
|||
#pragma warning(disable:4244 4996)
|
||||
#endif
|
||||
|
||||
#define WOLFSSL_CIPHER_LIST_MAX_SIZE 4096
|
||||
#ifndef WOLFSSL_CIPHER_LIST_MAX_SIZE
|
||||
#define WOLFSSL_CIPHER_LIST_MAX_SIZE 4096
|
||||
#endif
|
||||
/* Buffer for benchmark tests */
|
||||
#ifndef TEST_BUFFER_SIZE
|
||||
#define TEST_BUFFER_SIZE 16384
|
||||
#define TEST_BUFFER_SIZE 16384
|
||||
#endif
|
||||
|
||||
#ifndef WOLFSSL_HAVE_MIN
|
||||
|
|
Loading…
Reference in New Issue