aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKazuki Yamaguchi <k@rhe.jp>2016-05-05 14:37:28 +0900
committerKazuki Yamaguchi <k@rhe.jp>2016-05-14 20:00:57 +0900
commitb509f24241a7f3f7ee1e562ffe43856e6f8cf87f (patch)
tree43f5f68ac742ebaa9ea5a24e3a7ec4ba2728eb22
parent4b9b16cc2f652e199af0e14eb5bf9b85edef6da4 (diff)
downloadruby-b509f24241a7f3f7ee1e562ffe43856e6f8cf87f.tar.gz
ext/openssl: setting locking callbacks is no longer needed
These functions are made no-op.
-rw-r--r--ext/openssl/extconf.rb1
-rw-r--r--ext/openssl/ossl.c4
2 files changed, 5 insertions, 0 deletions
diff --git a/ext/openssl/extconf.rb b/ext/openssl/extconf.rb
index c49cef4657..58996c05a2 100644
--- a/ext/openssl/extconf.rb
+++ b/ext/openssl/extconf.rb
@@ -107,6 +107,7 @@ have_func("SSL_CTX_set_alpn_select_cb")
OpenSSL.check_func_or_macro("SSL_get_server_tmp_key", "openssl/ssl.h")
# added in 1.1.0
+have_func("CRYPTO_lock") || $defs.push("-DHAVE_OPENSSL_110_THREADING_API")
OpenSSL.check_func("RAND_pseudo_bytes", "openssl/rand.h") # deprecated
have_func("X509_STORE_get_ex_data")
have_func("X509_STORE_set_ex_data")
diff --git a/ext/openssl/ossl.c b/ext/openssl/ossl.c
index f1e23fe16f..a115878db3 100644
--- a/ext/openssl/ossl.c
+++ b/ext/openssl/ossl.c
@@ -460,6 +460,7 @@ ossl_fips_mode_set(VALUE self, VALUE enabled)
#endif
}
+#if !defined(HAVE_OPENSSL_110_THREADING_API)
/**
* Stores locks needed for OpenSSL thread safety
*/
@@ -547,6 +548,7 @@ static void Init_ossl_locks(void)
CRYPTO_set_dynlock_lock_callback(ossl_dyn_lock_callback);
CRYPTO_set_dynlock_destroy_callback(ossl_dyn_destroy_callback);
}
+#endif /* !HAVE_OPENSSL_110_THREADING_API */
/*
* OpenSSL provides SSL, TLS and general purpose cryptography. It wraps the
@@ -1147,7 +1149,9 @@ Init_openssl(void)
*/
ossl_s_to_der = rb_intern("to_der");
+#if !defined(HAVE_OPENSSL_110_THREADING_API)
Init_ossl_locks();
+#endif
/*
* Init components