Addressed review comment about id being undefined

pull/2209/head
Tesfa Mael 2019-06-04 16:05:57 -07:00
parent ade8f780a9
commit 25aeb8238e
1 changed files with 14 additions and 15 deletions

View File

@ -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);