From 25aeb8238effe23ad57aaa47e965ab92d0f61c8d Mon Sep 17 00:00:00 2001 From: Tesfa Mael Date: Tue, 4 Jun 2019 16:05:57 -0700 Subject: [PATCH] Addressed review comment about id being undefined --- tests/api.c | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/tests/api.c b/tests/api.c index acc6fa7f8..e823d87fa 100644 --- a/tests/api.c +++ b/tests/api.c @@ -22719,22 +22719,21 @@ static void test_wc_ecc_get_curve_id_from_dp_params(void) #if !defined(NO_ECC256) && !defined(NO_ECC_SECP) id = wc_ecc_get_curve_id_from_name("SECP256R1"); AssertIntEQ(id, ECC_SECP256R1); + + 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); + } #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);