fixed error handling

This commit is contained in:
Frank Morgner 2019-03-03 21:20:44 +01:00
parent d4f1decd15
commit eb8f28db20
2 changed files with 6 additions and 3 deletions

View File

@ -713,8 +713,11 @@ sc_pkcs15_convert_prkey(struct sc_pkcs15_prkey *pkcs15_key, void *evp_key)
/* get curve name */
nid = EC_GROUP_get_curve_name(grp);
if(nid != 0)
dst->params.named_curve = strdup(OBJ_nid2sn(nid));
if(nid != 0) {
const char *sn = OBJ_nid2sn(nid);
if (sn)
dst->params.named_curve = strdup(sn);
}
/* Decode EC_POINT from a octet string */
buflen = EC_POINT_point2oct(grp, (const EC_POINT *) EC_KEY_get0_public_key(src),

View File

@ -1672,7 +1672,7 @@ sc_pkcs15_convert_pubkey(struct sc_pkcs15_pubkey *pkcs15_key, void *evp_key)
nid = EC_GROUP_get_curve_name(grp);
if(nid != 0) {
const char *name = OBJ_nid2sn(nid);
if(sizeof(name) > 0)
if (name)
dst->params.named_curve = strdup(name);
}