From a1a6605d59beb1bfad5fba73e1ba2ae2466c3dfb Mon Sep 17 00:00:00 2001 From: Adam Langley Date: Sun, 9 Oct 2016 11:46:48 -0700 Subject: [PATCH] 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. --- src/node_crypto.cc | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/node_crypto.cc b/src/node_crypto.cc index 7ad6eceeecc0f7..83a819a09fb325 100644 --- a/src/node_crypto.cc +++ b/src/node_crypto.cc @@ -1095,7 +1095,7 @@ int SecureContext::TicketKeyCallback(SSL* ssl, static const int kTicketPartSize = 16; SecureContext* sc = static_cast( - SSL_CTX_get_app_data(ssl->ctx)); + SSL_CTX_get_app_data(SSL_get_SSL_CTX(ssl))); Environment* env = sc->env(); HandleScope handle_scope(env->isolate()); @@ -1632,7 +1632,7 @@ void SSLWrap::GetPeerCertificate( // Last certificate should be self-signed while (X509_check_issued(cert, cert) != X509_V_OK) { X509* ca; - if (SSL_CTX_get_issuer(w->ssl_->ctx, cert, &ca) <= 0) + if (SSL_CTX_get_issuer(SSL_get_SSL_CTX(w->ssl_), cert, &ca) <= 0) break; Local ca_info = X509ToObject(env, ca); @@ -2238,7 +2238,8 @@ void SSLWrap::SetALPNProtocols( env->alpn_buffer_private_symbol(), args[0]).FromJust()); // Server should select ALPN protocol from list of advertised by client - SSL_CTX_set_alpn_select_cb(w->ssl_->ctx, SelectALPNCallback, nullptr); + SSL_CTX_set_alpn_select_cb(SSL_get_SSL_CTX(w->ssl_), SelectALPNCallback, + nullptr); } #endif // TLSEXT_TYPE_application_layer_protocol_negotiation }