Skip to content

Commit c3d5b2b

Browse files
aglShigeki Ohtsu
authored and
Shigeki Ohtsu
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 2d89d3d commit c3d5b2b

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
@@ -521,10 +521,7 @@ int SSL_CTX_use_certificate_chain(SSL_CTX* ctx,
521521
// the CA certificates.
522522
int r;
523523

524-
if (ctx->extra_certs != nullptr) {
525-
sk_X509_pop_free(ctx->extra_certs, X509_free);
526-
ctx->extra_certs = nullptr;
527-
}
524+
SSL_CTX_clear_extra_chain_certs(ctx);
528525

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

0 commit comments

Comments
 (0)