diff --git a/src/node_crypto.cc b/src/node_crypto.cc index 78acf6d3972b41..8d7603ecb28c4e 100644 --- a/src/node_crypto.cc +++ b/src/node_crypto.cc @@ -235,8 +235,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) }; @@ -303,6 +301,9 @@ template int SSLWrap::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"); @@ -325,6 +326,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) { @@ -6162,9 +6164,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. */