aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKazuki Yamaguchi <k@rhe.jp>2016-04-20 17:59:01 +0900
committerKazuki Yamaguchi <k@rhe.jp>2016-04-27 23:07:41 +0900
commit91661b39556bc814e47a53d870ec3eb00f1e1942 (patch)
treee399f87c61a62523e3266cf1b42d9dbf725f3816
parent593f042addc9bec7dcf6743c7c643e37240ea04c (diff)
downloadruby-91661b39556bc814e47a53d870ec3eb00f1e1942.tar.gz
ext/openssl: support new threading API of OpenSSL 1.1.0
Setting locking callbacks is no longer needed.
-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 2dec2fb..2cdbc03 100644
--- a/ext/openssl/extconf.rb
+++ b/ext/openssl/extconf.rb
@@ -98,6 +98,7 @@ have_func("SSL_CTX_set_alpn_select_cb")
have_func("SSL_get_server_tmp_key", ["openssl/ssl.h"])
# added in 1.1.0
+have_func("CRYPTO_lock") || $defs.push("-DHAVE_OPENSSL_110_THREADING_API")
have_struct_member("SSL", "ctx", "openssl/ssl.h") || $defs.push("-DHAVE_OPAQUE_OPENSSL")
have_func("BN_GENCB_new")
have_func("BN_GENCB_free")
diff --git a/ext/openssl/ossl.c b/ext/openssl/ossl.c
index e184c9f..23a7e49 100644
--- a/ext/openssl/ossl.c
+++ b/ext/openssl/ossl.c
@@ -459,6 +459,7 @@ ossl_fips_mode_set(VALUE self, VALUE enabled)
#endif
}
+#if !defined(HAVE_OPENSSL_110_THREADING_API)
/**
* Stores locks needed for OpenSSL thread safety
*/
@@ -546,6 +547,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
@@ -1144,7 +1146,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