summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKazuki Yamaguchi <k@rhe.jp>2017-08-28 22:14:17 +0900
committerKazuki Yamaguchi <k@rhe.jp>2017-09-02 18:51:00 +0900
commit5b753d44a917bbc0f2399eaa9aa11702ee69f4db (patch)
treeb8f9bd2869d4a5c8ec0db2cc7631b891bdd8eca1
parentb44ab7f7e7e1c5f0cf618a347579d090b390103d (diff)
downloadruby-openssl-5b753d44a917bbc0f2399eaa9aa11702ee69f4db.tar.gz
ssl: prefer TLS_method() over SSLv23_method()
OpenSSL 1.1.0 replaced SSLv23_method() with TLS_method(). SSLv23_method which still exists in 1.1.0, as a macro around TLS_method, will eventually be removed. Use the new name if possible.
-rw-r--r--ext/openssl/ossl_ssl.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/ext/openssl/ossl_ssl.c b/ext/openssl/ossl_ssl.c
index f09430ef..974d7839 100644
--- a/ext/openssl/ossl_ssl.c
+++ b/ext/openssl/ossl_ssl.c
@@ -121,7 +121,11 @@ ossl_sslctx_s_alloc(VALUE klass)
VALUE obj;
obj = TypedData_Wrap_Struct(klass, &ossl_sslctx_type, 0);
+#if OPENSSL_VERSION_NUMBER >= 0x10100000 && !defined(LIBRESSL_VERSION_NUMBER)
+ ctx = SSL_CTX_new(TLS_method());
+#else
ctx = SSL_CTX_new(SSLv23_method());
+#endif
if (!ctx) {
ossl_raise(eSSLError, "SSL_CTX_new");
}