From 9929fb92ec5eef94190c43b92a4901712953b553 Mon Sep 17 00:00:00 2001 From: jsing <> Date: Wed, 28 Nov 2018 15:51:32 +0000 Subject: Correct lock initialisation for libcrypto. The current crypto_lock_init() function is not called early enough, meaning that locks are already in use before it gets called. Worse, locks could be in use when they are then initialised. Furthermore, since functions like CRYPTO_lock() are public API, these could be called directly bypassing initialisation. Avoid these issues by using static initialisers. ok bcook@ --- src/lib/libcrypto/crypto_init.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'src/lib/libcrypto/crypto_init.c') diff --git a/src/lib/libcrypto/crypto_init.c b/src/lib/libcrypto/crypto_init.c index 3745e2e718..67e7920890 100644 --- a/src/lib/libcrypto/crypto_init.c +++ b/src/lib/libcrypto/crypto_init.c @@ -23,6 +23,7 @@ #include #include #include + #include "cryptlib.h" int OpenSSL_config(const char *); @@ -30,17 +31,15 @@ int OpenSSL_no_config(void); static pthread_t crypto_init_thread; -void crypto_init_locks(void); - static void OPENSSL_init_crypto_internal(void) { crypto_init_thread = pthread_self(); + OPENSSL_cpuid_setup(); ERR_load_crypto_strings(); OpenSSL_add_all_ciphers(); OpenSSL_add_all_digests(); - crypto_init_locks(); } int -- cgit v1.2.3-55-g6feb