aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKazuki Yamaguchi <k@rhe.jp>2016-04-19 23:16:42 +0900
committerKazuki Yamaguchi <k@rhe.jp>2016-05-14 17:06:50 +0900
commitb8a970578aa636de6d534547902749c09c7492da (patch)
treec7643650795388fddf5e92702004c585f341e4d2
parent005ee0e45533e6b11722103418ebee9d3bba4a5d (diff)
downloadruby-b8a970578aa636de6d534547902749c09c7492da.tar.gz
ext/openssl: check if SSL_CTX_clear_options() is available
Fix build with early versions of OpenSSL 0.9.8. SSL_CTX_clear_options() was introduced in OpenSSL 0.9.8m, but unfortunately some Linux distributions still use 0.9.8e. * ext/openssl/extconf.rb: check existence of SSL_CTX_clear_options(). * ext/openssl/openssl_missing.h: implement the macro.
-rw-r--r--ext/openssl/extconf.rb1
-rw-r--r--ext/openssl/openssl_missing.h5
2 files changed, 6 insertions, 0 deletions
diff --git a/ext/openssl/extconf.rb b/ext/openssl/extconf.rb
index 9b3bdef085..5d33dd419c 100644
--- a/ext/openssl/extconf.rb
+++ b/ext/openssl/extconf.rb
@@ -113,6 +113,7 @@ have_func("TLSv1_1_client_method")
have_func("TLSv1_2_method")
have_func("TLSv1_2_server_method")
have_func("TLSv1_2_client_method")
+have_macro("SSL_CTX_clear_options", ["openssl/ssl.h"]) && $defs.push("-DHAVE_SSL_CTX_CLEAR_OPTIONS")
have_func("SSL_CTX_set_alpn_select_cb")
have_func("SSL_CTX_set_next_proto_select_cb")
have_macro("SSL_get_server_tmp_key", ['openssl/ssl.h']) && $defs.push("-DHAVE_SSL_GET_SERVER_TMP_KEY")
diff --git a/ext/openssl/openssl_missing.h b/ext/openssl/openssl_missing.h
index 2dc49d3fd2..6cf45a0d82 100644
--- a/ext/openssl/openssl_missing.h
+++ b/ext/openssl/openssl_missing.h
@@ -188,6 +188,11 @@ int PEM_def_callback(char *buf, int num, int w, void *key);
int ASN1_put_eoc(unsigned char **pp);
#endif
+#if !defined(HAVE_SSL_CTX_CLEAR_OPTIONS)
+# define SSL_CTX_clear_options(ctx, op) do \
+ (ctx)->options &= ~(op); while (0)
+#endif
+
#if defined(__cplusplus)
}
#endif