diff --git a/src/node_crypto.cc b/src/node_crypto.cc index 73cf5b2bb90..aedabce2e07 100644 --- a/src/node_crypto.cc +++ b/src/node_crypto.cc @@ -1756,21 +1756,18 @@ static Local X509ToObject(Environment* env, X509* cert) { CHECK_NULL(pub); } - if (EC_GROUP_get_asn1_flag(group) != 0) { + const int nid = EC_GROUP_get_curve_name(group); + if (nid != 0) { // Curve is well-known, get its OID and NIST nick-name (if it has one). - int nid = EC_GROUP_get_curve_name(group); - if (nid != 0) { - if (const char* sn = OBJ_nid2sn(nid)) { - info->Set(context, env->asn1curve_string(), - OneByteString(env->isolate(), sn)).FromJust(); - } + if (const char* sn = OBJ_nid2sn(nid)) { + info->Set(context, env->asn1curve_string(), + OneByteString(env->isolate(), sn)).FromJust(); } - if (nid != 0) { - if (const char* nist = EC_curve_nid2nist(nid)) { - info->Set(context, env->nistcurve_string(), - OneByteString(env->isolate(), nist)).FromJust(); - } + + if (const char* nist = EC_curve_nid2nist(nid)) { + info->Set(context, env->nistcurve_string(), + OneByteString(env->isolate(), nist)).FromJust(); } } else { // Unnamed curves can be described by their mathematical properties,