diff options
author | David Benjamin <davidben@google.com> | 2017-09-18 12:10:48 -0400 |
---|---|---|
committer | Rod Vagg <rod@vagg.org> | 2017-11-11 20:42:49 +1100 |
commit | 706ad8f89850dd5dc06b90e93c29792e88d9f3ea (patch) | |
tree | 3203a954018c413258955a2dbf63722da2040d10 /src/node_crypto.cc | |
parent | afee2ed490a458709514d686978d911fe6b7810c (diff) | |
download | android-node-v8-706ad8f89850dd5dc06b90e93c29792e88d9f3ea.tar.gz android-node-v8-706ad8f89850dd5dc06b90e93c29792e88d9f3ea.tar.bz2 android-node-v8-706ad8f89850dd5dc06b90e93c29792e88d9f3ea.zip |
crypto: remove locking callbacks for OpenSSL 1.1.0
The callbacks are all no-ops in OpenSSL 1.1.0. This isn't necessary (the
functions still exist for compatibility), but silences some warnings and
avoids allocating a few unused mutexes.
PR-URL: https://github.com/nodejs/node/pull/16130
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Rod Vagg <rod@vagg.org>
Diffstat (limited to 'src/node_crypto.cc')
-rw-r--r-- | src/node_crypto.cc | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/node_crypto.cc b/src/node_crypto.cc index 83309cec5a..b26b6f76d8 100644 --- a/src/node_crypto.cc +++ b/src/node_crypto.cc @@ -227,8 +227,6 @@ static X509_NAME *cnnic_ev_name = d2i_X509_NAME(nullptr, &cnnic_ev_p, sizeof(CNNIC_EV_ROOT_CA_SUBJECT_DATA)-1); -static Mutex* mutexes; - static const char* const root_certs[] = { #include "node_root_certs.h" // NOLINT(build/include_order) }; @@ -297,6 +295,9 @@ template int SSLWrap<TLSWrap>::SelectALPNCallback( void* arg); #endif // TLSEXT_TYPE_application_layer_protocol_negotiation +#if OPENSSL_VERSION_NUMBER < 0x10100000L +static Mutex* mutexes; + static void crypto_threadid_cb(CRYPTO_THREADID* tid) { static_assert(sizeof(uv_thread_t) <= sizeof(void*), "uv_thread_t does not fit in a pointer"); @@ -319,6 +320,7 @@ static void crypto_lock_cb(int mode, int n, const char* file, int line) { else mutex->Unlock(); } +#endif static int PasswordCallback(char *buf, int size, int rwflag, void *u) { @@ -5976,9 +5978,11 @@ void InitCryptoOnce() { SSL_library_init(); OpenSSL_add_all_algorithms(); +#if OPENSSL_VERSION_NUMBER < 0x10100000L crypto_lock_init(); CRYPTO_set_locking_callback(crypto_lock_cb); CRYPTO_THREADID_set_callback(crypto_threadid_cb); +#endif #ifdef NODE_FIPS_MODE /* Override FIPS settings in cnf file, if needed. */ |