diff options
author | Kazuki Yamaguchi <k@rhe.jp> | 2020-08-21 17:33:25 +0900 |
---|---|---|
committer | Kazuki Yamaguchi <k@rhe.jp> | 2021-04-04 23:28:38 +0900 |
commit | 7276233e1ade65465aa89b8b777ebe05608a1468 (patch) | |
tree | 6ea65b82c62b07bbcc55d739e6cdb21072771dff /ext/openssl | |
parent | 3b7d7045b8df7871fe17209d7fb07911f9428b5d (diff) | |
download | ruby-openssl-7276233e1ade65465aa89b8b777ebe05608a1468.tar.gz |
ossl.c: do not set locking callbacks on LibreSSLky/drop-openssl-1.0.1
Similarly to OpenSSL >= 1.1.0, LibreSSL 2.9.0 ensures thread safety
without requiring applications to set locking callbacks and made
related functions no-op.
Diffstat (limited to 'ext/openssl')
-rw-r--r-- | ext/openssl/extconf.rb | 1 | ||||
-rw-r--r-- | ext/openssl/ossl.c | 8 |
2 files changed, 7 insertions, 2 deletions
diff --git a/ext/openssl/extconf.rb b/ext/openssl/extconf.rb index 73a4cdc3..bd7c5770 100644 --- a/ext/openssl/extconf.rb +++ b/ext/openssl/extconf.rb @@ -130,7 +130,6 @@ engines.each { |name| if !have_struct_member("SSL", "ctx", "openssl/ssl.h") || is_libressl $defs.push("-DHAVE_OPAQUE_OPENSSL") end -have_func("CRYPTO_lock") || $defs.push("-DHAVE_OPENSSL_110_THREADING_API") have_func("BN_GENCB_new") have_func("BN_GENCB_free") have_func("BN_GENCB_get_arg") diff --git a/ext/openssl/ossl.c b/ext/openssl/ossl.c index 7bdf3a2e..cb084cd9 100644 --- a/ext/openssl/ossl.c +++ b/ext/openssl/ossl.c @@ -9,7 +9,13 @@ */ #include "ossl.h" #include <stdarg.h> /* for ossl_raise */ -#include <ruby/thread_native.h> /* for OpenSSL < 1.1.0 locks */ + +/* OpenSSL >= 1.1.0 and LibreSSL >= 2.9.0 */ +#if defined(LIBRESSL_VERSION_NUMBER) || OPENSSL_VERSION_NUMBER >= 0x10100000 +# define HAVE_OPENSSL_110_THREADING_API +#else +# include <ruby/thread_native.h> +#endif /* * Data Conversion |