summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordaurnimator <quae@daurnimator.com>2017-08-31 02:56:07 +1000
committerdaurnimator <quae@daurnimator.com>2017-08-31 02:56:49 +1000
commita639d67b566b55a5add82505dc4b6f819820f533 (patch)
treed5d30aa5bae04beabf78bcad2558bc918ce92489 /src
parente917b0805fc9374b06cfd93204aefe5d3375d8d4 (diff)
downloadluaossl-a639d67b566b55a5add82505dc4b6f819820f533.tar.gz
luaossl-a639d67b566b55a5add82505dc4b6f819820f533.tar.bz2
luaossl-a639d67b566b55a5add82505dc4b6f819820f533.zip
openssl >=1.1.0 doesn't need to have locking initialised, nor config manually loaded
Part of #96
Diffstat (limited to 'src')
-rw-r--r--src/openssl.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/openssl.c b/src/openssl.c
index 1b11207..cb4bd48 100644
--- a/src/openssl.c
+++ b/src/openssl.c
@@ -10371,9 +10371,12 @@ int luaopen__openssl_des(lua_State *L) {
10371} /* luaopen__openssl_des() */ 10371} /* luaopen__openssl_des() */
10372 10372
10373 10373
10374#if !OPENSSL_PREREQ(1,1,0)
10374/* 10375/*
10375 * Multithread Reentrancy Protection 10376 * Multithread Reentrancy Protection
10376 * 10377 *
10378 * Pre-1.0.2, OpenSSL needs to be given locking primitives
10379 *
10377 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 10380 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
10378 10381
10379static struct { 10382static struct {
@@ -10470,15 +10473,19 @@ epilog:
10470 return error; 10473 return error;
10471} /* mt_init() */ 10474} /* mt_init() */
10472 10475
10476#endif /* !OPENSSL_PREREQ(1,1,0) */
10477
10473 10478
10474static void initall(lua_State *L) { 10479static void initall(lua_State *L) {
10475 static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; 10480 static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
10476 static int initssl; 10481 static int initssl;
10477 int error; 10482 int error = 0;
10478 10483
10479 pthread_mutex_lock(&mutex); 10484 pthread_mutex_lock(&mutex);
10480 10485
10481 error = mt_init(); 10486#if !OPENSSL_PREREQ(1,1,0)
10487 if (!error)
10488 error = mt_init();
10482 10489
10483 if (!error && !initssl) { 10490 if (!error && !initssl) {
10484 initssl = 1; 10491 initssl = 1;
@@ -10493,6 +10500,7 @@ static void initall(lua_State *L) {
10493 */ 10500 */
10494 OPENSSL_config(NULL); 10501 OPENSSL_config(NULL);
10495 } 10502 }
10503#endif
10496 10504
10497 if (!error) 10505 if (!error)
10498 error = compat_init(); 10506 error = compat_init();