aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatarLibravatar daurnimator <quae@daurnimator.com> 2017-08-31 02:56:07 +1000
committerLibravatarLibravatar daurnimator <quae@daurnimator.com> 2017-08-31 02:56:49 +1000
commita639d67b566b55a5add82505dc4b6f819820f533 (patch)
treed5d30aa5bae04beabf78bcad2558bc918ce92489
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
-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) {
} /* 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();