Skip to content

Instantly share code, notes, and snippets.

@tonylambiris
Created August 4, 2016 05:43
Show Gist options
  • Save tonylambiris/1719d4706715a525517cad5a8bc7683b to your computer and use it in GitHub Desktop.
Save tonylambiris/1719d4706715a525517cad5a8bc7683b to your computer and use it in GitHub Desktop.
asio SSLv3 patch
Description: Conditionalize SSLv3 support for OpenSSL
Author: Markus Wanner <markus@bluegap.ch>
Forwarded: no
--- a/include/asio/ssl/old/detail/openssl_context_service.hpp
+++ b/include/asio/ssl/old/detail/openssl_context_service.hpp
@@ -84,6 +84,13 @@
impl = ::SSL_CTX_new(::SSLv2_server_method());
break;
#endif // defined(OPENSSL_NO_SSL2)
+#if defined(OPENSSL_NO_SSL3)
+ case context_base::sslv3:
+ case context_base::sslv3_client:
+ case context_base::sslv3_server:
+ asio::detail::throw_error(asio::error::invalid_argument);
+ break;
+#else // defined(OPENSSL_NO_SSL3)
case context_base::sslv3:
impl = ::SSL_CTX_new(::SSLv3_method());
break;
@@ -93,6 +100,7 @@
case context_base::sslv3_server:
impl = ::SSL_CTX_new(::SSLv3_server_method());
break;
+#endif
case context_base::tlsv1:
impl = ::SSL_CTX_new(::TLSv1_method());
break;
--- a/include/asio/ssl/impl/context.ipp
+++ b/include/asio/ssl/impl/context.ipp
@@ -88,6 +88,14 @@
handle_ = ::SSL_CTX_new(::SSLv2_server_method());
break;
#endif // defined(OPENSSL_NO_SSL2)
+#if defined(OPENSSL_NO_SSL3)
+ case context::sslv3:
+ case context::sslv3_client:
+ case context::sslv3_server:
+ asio::detail::throw_error(
+ asio::error::invalid_argument, "context");
+ break;
+#else // defined(OPENSSL_NO_SSL3)
case context::sslv3:
handle_ = ::SSL_CTX_new(::SSLv3_method());
break;
@@ -97,6 +105,7 @@
case context::sslv3_server:
handle_ = ::SSL_CTX_new(::SSLv3_server_method());
break;
+#endif
case context::tlsv1:
handle_ = ::SSL_CTX_new(::TLSv1_method());
break;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment