Skip to content

Instantly share code, notes, and snippets.

@Tyrael
Created September 24, 2014 08:21
Show Gist options
  • Select an option

  • Save Tyrael/515508d380c416ae2053 to your computer and use it in GitHub Desktop.

Select an option

Save Tyrael/515508d380c416ae2053 to your computer and use it in GitHub Desktop.
diff --git a/ext/openssl/xp_ssl.c b/ext/openssl/xp_ssl.c
index 1eed2eb..a74a090 100644
--- a/ext/openssl/xp_ssl.c
+++ b/ext/openssl/xp_ssl.c
@@ -902,7 +902,13 @@ static const SSL_METHOD *php_select_crypto_method(long method_value, int is_clie
return NULL;
#endif
} else if (method_value == STREAM_CRYPTO_METHOD_SSLv3) {
+#ifndef OPENSSL_NO_SSL3
return is_client ? SSLv3_client_method() : SSLv3_server_method();
+#else
+ php_error_docref(NULL TSRMLS_CC, E_WARNING,
+ "SSLv3 support is not compiled into the OpenSSL library PHP is linked against");
+ return NULL;
+#endif
} else if (method_value == STREAM_CRYPTO_METHOD_TLSv1_0) {
return is_client ? TLSv1_client_method() : TLSv1_server_method();
} else if (method_value == STREAM_CRYPTO_METHOD_TLSv1_1) {
@@ -2247,8 +2253,13 @@ php_stream *php_openssl_ssl_socket_factory(const char *proto, size_t protolen,
sslsock->method = STREAM_CRYPTO_METHOD_SSLv2_CLIENT;
#endif
} else if (strncmp(proto, "sslv3", protolen) == 0) {
+#ifdef OPENSSL_NO_SSL3
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "SSLv3 support is not compiled into the OpenSSL library PHP is linked against");
+ return NULL;
+#else
sslsock->enable_on_connect = 1;
sslsock->method = STREAM_CRYPTO_METHOD_SSLv3_CLIENT;
+#endif
} else if (strncmp(proto, "tls", protolen) == 0) {
sslsock->enable_on_connect = 1;
sslsock->method = get_crypto_method(context, STREAM_CRYPTO_METHOD_TLS_CLIENT);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment