Browse Source

crypto: use X509V3_EXT_d2i

There is no need to reach into quite so many internals to decode an
extension.

PR-URL: https://github.com/nodejs/node/pull/15348
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
canary-base
David Benjamin 7 years ago
committed by Ruben Bridgewater
parent
commit
9af9bcbaf5
No known key found for this signature in database GPG Key ID: F07496B3EB3C1762
  1. 7
      src/node_crypto.cc

7
src/node_crypto.cc

@ -1477,12 +1477,7 @@ static bool SafeX509ExtPrint(BIO* out, X509_EXTENSION* ext) {
if (method != X509V3_EXT_get_nid(NID_subject_alt_name)) if (method != X509V3_EXT_get_nid(NID_subject_alt_name))
return false; return false;
const unsigned char* p = ext->value->data; GENERAL_NAMES* names = static_cast<GENERAL_NAMES*>(X509V3_EXT_d2i(ext));
GENERAL_NAMES* names = reinterpret_cast<GENERAL_NAMES*>(ASN1_item_d2i(
NULL,
&p,
ext->value->length,
ASN1_ITEM_ptr(method->it)));
if (names == NULL) if (names == NULL)
return false; return false;

Loading…
Cancel
Save