From 1ece540577161333a4b006d6329fc8f03ca3bd4c Mon Sep 17 00:00:00 2001 From: Peter Keresztes Schmidt Date: Sun, 2 Jul 2023 15:15:04 +0200 Subject: [PATCH] Common/Crypto: #ifdef out unnecessary locking code for OpenSSL 1.1+ --- src/common/Cryptography/OpenSSLCrypto.cpp | 6 +++++- src/common/Cryptography/OpenSSLCrypto.h | 7 +++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/common/Cryptography/OpenSSLCrypto.cpp b/src/common/Cryptography/OpenSSLCrypto.cpp index 6bc8571f28..b3412a1e96 100644 --- a/src/common/Cryptography/OpenSSLCrypto.cpp +++ b/src/common/Cryptography/OpenSSLCrypto.cpp @@ -15,8 +15,10 @@ * with this program. If not, see . */ -#include +#include "OpenSSLCrypto.h" #include + +#if defined(OPENSSL_VERSION_NUMBER) && OPENSSL_VERSION_NUMBER < 0x1010000fL #include #include #include @@ -62,3 +64,5 @@ void OpenSSLCrypto::threadsCleanup() } cryptoLocks.resize(0); } + +#endif diff --git a/src/common/Cryptography/OpenSSLCrypto.h b/src/common/Cryptography/OpenSSLCrypto.h index 09ab6bf7a7..75815092f4 100644 --- a/src/common/Cryptography/OpenSSLCrypto.h +++ b/src/common/Cryptography/OpenSSLCrypto.h @@ -19,6 +19,7 @@ #define OPENSSL_CRYPTO_H #include "Define.h" +#include /** * A group of functions which setup openssl crypto module to work properly in multithreaded enviroment @@ -26,10 +27,16 @@ */ namespace OpenSSLCrypto { + +#if defined(OPENSSL_VERSION_NUMBER) && OPENSSL_VERSION_NUMBER < 0x1010000fL /// Needs to be called before threads using openssl are spawned TC_COMMON_API void threadsSetup(); /// Needs to be called after threads using openssl are despawned TC_COMMON_API void threadsCleanup(); +#else + void threadsSetup() { }; + void threadsCleanup() { }; +#endif } #endif