about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2019-09-04T12·14+0200
committerEelco Dolstra <edolstra@gmail.com>2019-10-09T14·25+0200
commitfa028194e9e707e7aa35990e074f5c6672b50f98 (patch)
tree0de89ec12db696b76d3b760547d5d9ace04e1d98
parentff7fcd3805dfbbf628738f2c754b5a2199528710 (diff)
Disable OpenSSL lock callback on OpenSSL >= 1.1.1
(cherry picked from commit a56b51a0ba7b0d6fdff7fd0127a118185b146f4f)
-rw-r--r--src/libmain/shared.cc4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/libmain/shared.cc b/src/libmain/shared.cc
index 0afddfb785dd..d3dbfbc44592 100644
--- a/src/libmain/shared.cc
+++ b/src/libmain/shared.cc
@@ -80,6 +80,7 @@ string getArg(const string & opt,
 }
 
 
+#if OPENSSL_VERSION_NUMBER < 0x10101000L
 /* OpenSSL is not thread-safe by default - it will randomly crash
    unless the user supplies a mutex locking function. So let's do
    that. */
@@ -92,6 +93,7 @@ static void opensslLockCallback(int mode, int type, const char * file, int line)
     else
         opensslLocks[type].unlock();
 }
+#endif
 
 
 static void sigHandler(int signo) { }
@@ -105,9 +107,11 @@ void initNix()
     std::cerr.rdbuf()->pubsetbuf(buf, sizeof(buf));
 #endif
 
+#if OPENSSL_VERSION_NUMBER < 0x10101000L
     /* Initialise OpenSSL locking. */
     opensslLocks = std::vector<std::mutex>(CRYPTO_num_locks());
     CRYPTO_set_locking_callback(opensslLockCallback);
+#endif
 
     loadConfFile();