Support for building with OpenSSL 1.0 when OPENSSL_NO_SSL2 is defined.

This commit is contained in:
Christopher Kohlhoff 2011-04-20 22:48:18 +10:00
parent 6f13d6dc31
commit a10f0db8cc
3 changed files with 22 additions and 0 deletions

View File

@ -37,6 +37,10 @@ engine::engine(SSL_CTX* context)
::SSL_set_mode(ssl_, SSL_MODE_ENABLE_PARTIAL_WRITE);
::SSL_set_mode(ssl_, SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER);
#if defined(SSL_MODE_RELEASE_BUFFERS)
::SSL_set_mode(ssl_, SSL_MODE_RELEASE_BUFFERS);
#endif // defined(SSL_MODE_RELEASE_BUFFERS)
::BIO* int_bio = 0;
::BIO_new_bio_pair(&int_bio, 0, &ext_bio_, 0);
::SSL_set_bio(ssl_, int_bio, int_bio);

View File

@ -38,6 +38,14 @@ context::context(context::method m)
{
switch (m)
{
#if defined(OPENSSL_NO_SSL2)
case context::sslv2:
case context::sslv2_client:
case context::sslv2_server:
asio::detail::throw_error(
asio::error::invalid_argument, "context");
break;
#else // defined(OPENSSL_NO_SSL2)
case context::sslv2:
handle_ = ::SSL_CTX_new(::SSLv2_method());
break;
@ -47,6 +55,7 @@ context::context(context::method m)
case context::sslv2_server:
handle_ = ::SSL_CTX_new(::SSLv2_server_method());
break;
#endif // defined(OPENSSL_NO_SSL2)
case context::sslv3:
handle_ = ::SSL_CTX_new(::SSLv3_method());
break;

View File

@ -20,6 +20,7 @@
#include <cstring>
#include <string>
#include <boost/function.hpp>
#include "asio/detail/throw_error.hpp"
#include "asio/error.hpp"
#include "asio/io_service.hpp"
#include "asio/ssl/context_base.hpp"
@ -66,6 +67,13 @@ public:
{
switch (m)
{
#if defined(OPENSSL_NO_SSL2)
case context_base::sslv2:
case context_base::sslv2_client:
case context_base::sslv2_server:
asio::detail::throw_error(asio::error::invalid_argument);
break;
#else // defined(OPENSSL_NO_SSL2)
case context_base::sslv2:
impl = ::SSL_CTX_new(::SSLv2_method());
break;
@ -75,6 +83,7 @@ public:
case context_base::sslv2_server:
impl = ::SSL_CTX_new(::SSLv2_server_method());
break;
#endif // defined(OPENSSL_NO_SSL2)
case context_base::sslv3:
impl = ::SSL_CTX_new(::SSLv3_method());
break;