Skip to content

Commit 9cfa91b

Browse files
aglMyles Borins
authored and
Myles Borins
committed
crypto: use SSL_get_SSL_CTX.
SSL_get_SSL_CTX returns the SSL_CTX for an SSL. Previously the code accessed |ssl->ctx| directly, but that's no longer possible with OpenSSL 1.1.0. SSL_get_SSL_CTX exists all the way back to (at least) OpenSSL 0.9.8 and so this change should be fully compatible. PR-URL: #8995 Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Fedor Indutny <[email protected]> Reviewed-By: Shigeki Ohtsu <[email protected]>
1 parent 9cc9001 commit 9cfa91b

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/node_crypto.cc

+4-3
Original file line numberDiff line numberDiff line change
@@ -1095,7 +1095,7 @@ int SecureContext::TicketKeyCallback(SSL* ssl,
10951095
static const int kTicketPartSize = 16;
10961096

10971097
SecureContext* sc = static_cast<SecureContext*>(
1098-
SSL_CTX_get_app_data(ssl->ctx));
1098+
SSL_CTX_get_app_data(SSL_get_SSL_CTX(ssl)));
10991099

11001100
Environment* env = sc->env();
11011101
HandleScope handle_scope(env->isolate());
@@ -1632,7 +1632,7 @@ void SSLWrap<Base>::GetPeerCertificate(
16321632
// Last certificate should be self-signed
16331633
while (X509_check_issued(cert, cert) != X509_V_OK) {
16341634
X509* ca;
1635-
if (SSL_CTX_get_issuer(w->ssl_->ctx, cert, &ca) <= 0)
1635+
if (SSL_CTX_get_issuer(SSL_get_SSL_CTX(w->ssl_), cert, &ca) <= 0)
16361636
break;
16371637

16381638
Local<Object> ca_info = X509ToObject(env, ca);
@@ -2238,7 +2238,8 @@ void SSLWrap<Base>::SetALPNProtocols(
22382238
env->alpn_buffer_private_symbol(),
22392239
args[0]).FromJust());
22402240
// Server should select ALPN protocol from list of advertised by client
2241-
SSL_CTX_set_alpn_select_cb(w->ssl_->ctx, SelectALPNCallback, nullptr);
2241+
SSL_CTX_set_alpn_select_cb(SSL_get_SSL_CTX(w->ssl_), SelectALPNCallback,
2242+
nullptr);
22422243
}
22432244
#endif // TLSEXT_TYPE_application_layer_protocol_negotiation
22442245
}

0 commit comments

Comments
 (0)