[MacOSX] Manage older OpenSSL API (needed for OSX 10.6) and probably older linuxes

This commit is contained in:
Marco Serantoni 2013-12-31 11:48:16 +01:00
parent 7ffd6db5b4
commit 6d2db4783e
1 changed files with 55 additions and 0 deletions

View File

@ -0,0 +1,55 @@
=== modified file 'boost/asio/ssl/impl/context.ipp'
--- boost/asio/ssl/impl/context.ipp 2013-12-30 14:53:15 +0000
+++ boost/asio/ssl/impl/context.ipp 2013-12-30 19:08:01 +0000
@@ -236,19 +236,27 @@
boost::system::error_code context::clear_options(
context::options o, boost::system::error_code& ec)
{
-#if !defined(SSL_OP_NO_COMPRESSION)
+#if (OPENSSL_VERSION_NUMBER >= 0x009080DFL) \
+ && (OPENSSL_VERSION_NUMBER != 0x00909000L)
+# if !defined(SSL_OP_NO_COMPRESSION)
if ((o & context::no_compression) != 0)
{
-#if (OPENSSL_VERSION_NUMBER >= 0x00908000L)
+# if (OPENSSL_VERSION_NUMBER >= 0x00908000L)
handle_->comp_methods = SSL_COMP_get_compression_methods();
-#endif // (OPENSSL_VERSION_NUMBER >= 0x00908000L)
+# endif // (OPENSSL_VERSION_NUMBER >= 0x00908000L)
o ^= context::no_compression;
}
-#endif // !defined(SSL_OP_NO_COMPRESSION)
+# endif // !defined(SSL_OP_NO_COMPRESSION)
::SSL_CTX_clear_options(handle_, o);
ec = boost::system::error_code();
+#else // (OPENSSL_VERSION_NUMBER >= 0x009080DFL)
+ // && (OPENSSL_VERSION_NUMBER != 0x00909000L)
+ (void)o;
+ ec = boost::asio::error::operation_not_supported;
+#endif // (OPENSSL_VERSION_NUMBER >= 0x009080DFL)
+ // && (OPENSSL_VERSION_NUMBER != 0x00909000L)
return ec;
}
@@ -428,7 +436,8 @@
if (format == context_base::asn1)
{
- if (::SSL_CTX_use_certificate_ASN1(handle_, buffer_size(certificate),
+ if (::SSL_CTX_use_certificate_ASN1(handle_,
+ static_cast<int>(buffer_size(certificate)),
buffer_cast<const unsigned char*>(certificate)) == 1)
{
ec = boost::system::error_code();
@@ -929,7 +938,7 @@
{
return ::BIO_new_mem_buf(
const_cast<void*>(buffer_cast<const void*>(b)),
- buffer_size(b));
+ static_cast<int>(buffer_size(b)));
}
#endif // !defined(BOOST_ASIO_ENABLE_OLD_SSL)