Skip to content

Commit 6c3ae36

Browse files
davidbenevanlucas
authored andcommitted
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: #16130 Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Rod Vagg <[email protected]>
1 parent 81760ff commit 6c3ae36

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/node_crypto.cc

+6-2
Original file line numberDiff line numberDiff line change
@@ -234,8 +234,6 @@ static X509_NAME *cnnic_ev_name =
234234
d2i_X509_NAME(nullptr, &cnnic_ev_p,
235235
sizeof(CNNIC_EV_ROOT_CA_SUBJECT_DATA)-1);
236236

237-
static Mutex* mutexes;
238-
239237
static const char* const root_certs[] = {
240238
#include "node_root_certs.h" // NOLINT(build/include_order)
241239
};
@@ -304,6 +302,9 @@ template int SSLWrap<TLSWrap>::SelectALPNCallback(
304302
void* arg);
305303
#endif // TLSEXT_TYPE_application_layer_protocol_negotiation
306304

305+
#if OPENSSL_VERSION_NUMBER < 0x10100000L
306+
static Mutex* mutexes;
307+
307308
static void crypto_threadid_cb(CRYPTO_THREADID* tid) {
308309
static_assert(sizeof(uv_thread_t) <= sizeof(void*),
309310
"uv_thread_t does not fit in a pointer");
@@ -326,6 +327,7 @@ static void crypto_lock_cb(int mode, int n, const char* file, int line) {
326327
else
327328
mutex->Unlock();
328329
}
330+
#endif
329331

330332

331333
static int PasswordCallback(char *buf, int size, int rwflag, void *u) {
@@ -6007,9 +6009,11 @@ void InitCryptoOnce() {
60076009
SSL_library_init();
60086010
OpenSSL_add_all_algorithms();
60096011

6012+
#if OPENSSL_VERSION_NUMBER < 0x10100000L
60106013
crypto_lock_init();
60116014
CRYPTO_set_locking_callback(crypto_lock_cb);
60126015
CRYPTO_THREADID_set_callback(crypto_threadid_cb);
6016+
#endif
60136017

60146018
#ifdef NODE_FIPS_MODE
60156019
/* Override FIPS settings in cnf file, if needed. */

0 commit comments

Comments
 (0)