From ca24af3701127d3e35373ead79a5386d15118625 Mon Sep 17 00:00:00 2001 From: David Benjamin Date: Thu, 10 Aug 2017 22:32:11 -0400 Subject: [PATCH] crypto: account for OpenSSL 1.1.0 function signature change. In OpenSSL 1.1.0, SSL_CTX_sess_set_get_cb's callback has a slightly different function signature, see [1]. Account for that with an OPENSSL_VERSION_NUMBER check. This gets a little closer to 1.1.0 compatibility. [1] https://git.openssl.org/gitweb/?p=openssl.git;a=blob;f=include/openssl/ssl.h;h=41cb36e9438e1debf4f1abba47f2d8d273883ffa;hb=abd30777cc72029e8a44e4b67201cae8ed3d19c1#l618 --- src/node_crypto.cc | 8 ++++++++ src/node_crypto.h | 4 ++++ 2 files changed, 12 insertions(+) diff --git a/src/node_crypto.cc b/src/node_crypto.cc index 664bf1a72c7e8c..798752d74f6ce6 100644 --- a/src/node_crypto.cc +++ b/src/node_crypto.cc @@ -162,7 +162,11 @@ template void SSLWrap::SetSNIContext(SecureContext* sc); template int SSLWrap::SetCACerts(SecureContext* sc); template SSL_SESSION* SSLWrap::GetSessionCallback( SSL* s, +#if OPENSSL_VERSION_NUMBER < 0x10100000L unsigned char* key, +#else + const unsigned char *key, +#endif int len, int* copy); template int SSLWrap::NewSessionCallback(SSL* s, @@ -1394,7 +1398,11 @@ void SSLWrap::InitNPN(SecureContext* sc) { template SSL_SESSION* SSLWrap::GetSessionCallback(SSL* s, +#if OPENSSL_VERSION_NUMBER < 0x10100000L unsigned char* key, +#else + const unsigned char* key, +#endif int len, int* copy) { Base* w = static_cast(SSL_get_app_data(s)); diff --git a/src/node_crypto.h b/src/node_crypto.h index 3abfe973a79ebd..c3d728fef56a2c 100644 --- a/src/node_crypto.h +++ b/src/node_crypto.h @@ -232,7 +232,11 @@ class SSLWrap { static void AddMethods(Environment* env, v8::Local t); static SSL_SESSION* GetSessionCallback(SSL* s, +#if OPENSSL_VERSION_NUMBER < 0x10100000L unsigned char* key, +#else + const unsigned char* key, +#endif int len, int* copy); static int NewSessionCallback(SSL* s, SSL_SESSION* sess);