aboutsummaryrefslogtreecommitdiff
path: root/src/common
diff options
context:
space:
mode:
authorPeter Keresztes Schmidt <carbenium@outlook.com>2020-07-25 03:44:38 +0200
committerShauren <shauren.trinity@gmail.com>2022-01-23 23:07:33 +0100
commit10f835b058ffa517866b08efe6634b0d5226bb66 (patch)
tree3c21feca49a0ee541d5ba562da4b91123918ef81 /src/common
parent699c9ed4148640d18f1ba59596e364279e4ceeec (diff)
Common/Crypto: #ifdef out unnecessary locking code for OpenSSL 1.1+ (PR #25110)
(cherry picked from commit 7ea33120a03d70aaa856c2c66f183d684131746e)
Diffstat (limited to 'src/common')
-rw-r--r--src/common/Cryptography/OpenSSLCrypto.cpp5
-rw-r--r--src/common/Cryptography/OpenSSLCrypto.h8
2 files changed, 12 insertions, 1 deletions
diff --git a/src/common/Cryptography/OpenSSLCrypto.cpp b/src/common/Cryptography/OpenSSLCrypto.cpp
index ccb20431673..3346a1c2098 100644
--- a/src/common/Cryptography/OpenSSLCrypto.cpp
+++ b/src/common/Cryptography/OpenSSLCrypto.cpp
@@ -15,8 +15,10 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include <OpenSSLCrypto.h>
+#include "OpenSSLCrypto.h"
#include <openssl/crypto.h>
+
+#if defined(OPENSSL_VERSION_NUMBER) && OPENSSL_VERSION_NUMBER < 0x1010000fL
#include <vector>
#include <thread>
#include <mutex>
@@ -67,6 +69,7 @@ void OpenSSLCrypto::threadsCleanup()
}
cryptoLocks.resize(0);
}
+#endif
#ifdef VALGRIND
#include <openssl/rand.h>
diff --git a/src/common/Cryptography/OpenSSLCrypto.h b/src/common/Cryptography/OpenSSLCrypto.h
index 09ab6bf7a72..8aa0abef88d 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 <openssl/opensslv.h>
/**
* A group of functions which setup openssl crypto module to work properly in multithreaded enviroment
@@ -26,10 +27,17 @@
*/
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