Skip to content

Commit ab5cb05

Browse files
aglMyles Borins
authored and
Myles Borins
committed
crypto: use SSL_CTX_clear_extra_chain_certs.
The SSL_CTX_clear_extra_chain_certs function clears the extra certificates associated with an SSL_CTX without reaching into the SSL_CTX structure itself (which will become impossible in OpenSSL 1.1.0). The underlying implementation in OpenSSL[1] is the same what the code was doing and OpenSSL has provided this function since 0.9.8 so this change should be fully compatible. [1] https://github.com/nodejs/node/blob/master/deps/openssl/openssl/ssl/s3_lib.c#L3899 PR-URL: #4919 Reviewed-By: Fedor Indutny <[email protected]> Reviewed-By: Shigeki Ohtsu <[email protected]>
1 parent 198928e commit ab5cb05

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

src/node_crypto.cc

+1-4
Original file line numberDiff line numberDiff line change
@@ -532,10 +532,7 @@ int SSL_CTX_use_certificate_chain(SSL_CTX* ctx,
532532
// the CA certificates.
533533
int r;
534534

535-
if (ctx->extra_certs != nullptr) {
536-
sk_X509_pop_free(ctx->extra_certs, X509_free);
537-
ctx->extra_certs = nullptr;
538-
}
535+
SSL_CTX_clear_extra_chain_certs(ctx);
539536

540537
for (int i = 0; i < sk_X509_num(extra_certs); i++) {
541538
X509* ca = sk_X509_value(extra_certs, i);

0 commit comments

Comments
 (0)