From a639d67b566b55a5add82505dc4b6f819820f533 Mon Sep 17 00:00:00 2001 From: daurnimator Date: Thu, 31 Aug 2017 02:56:07 +1000 Subject: openssl >=1.1.0 doesn't need to have locking initialised, nor config manually loaded Part of #96 --- src/openssl.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'src') 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) { } /* luaopen__openssl_des() */ +#if !OPENSSL_PREREQ(1,1,0) /* * Multithread Reentrancy Protection * + * Pre-1.0.2, OpenSSL needs to be given locking primitives + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ static struct { @@ -10470,15 +10473,19 @@ epilog: return error; } /* mt_init() */ +#endif /* !OPENSSL_PREREQ(1,1,0) */ + static void initall(lua_State *L) { static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; static int initssl; - int error; + int error = 0; pthread_mutex_lock(&mutex); - error = mt_init(); +#if !OPENSSL_PREREQ(1,1,0) + if (!error) + error = mt_init(); if (!error && !initssl) { initssl = 1; @@ -10493,6 +10500,7 @@ static void initall(lua_State *L) { */ OPENSSL_config(NULL); } +#endif if (!error) error = compat_init(); -- cgit v1.2.3-55-g6feb