$include_dir="/home/hyper-archives/boost-commit/include"; include("$include_dir/msg-header.inc") ?>
Subject: [Boost-commit] svn:boost r84320 - in trunk/boost/asio/ssl: . impl
From: chris_at_[hidden]
Date: 2013-05-17 06:57:04
Author: chris_kohlhoff
Date: 2013-05-17 06:57:02 EDT (Fri, 17 May 2013)
New Revision: 84320
URL: http://svn.boost.org/trac/boost/changeset/84320
Log:
Support for creation of TLSv1.1 and TLSv1.2 contexts.
Thanks go to Alvin Cheung <alvin dot cheung at alumni dot ust dot hk>
and Nick Jones <nick dot fa dot jones at gmail dot com>, on whose work
this is based.
Text files modified: 
   trunk/boost/asio/ssl/context_base.hpp |    20 +++++++++++++++++++-                    
   trunk/boost/asio/ssl/impl/context.ipp |    36 ++++++++++++++++++++++++++++++++++++    
   2 files changed, 55 insertions(+), 1 deletions(-)
Modified: trunk/boost/asio/ssl/context_base.hpp
==============================================================================
--- trunk/boost/asio/ssl/context_base.hpp	(original)
+++ trunk/boost/asio/ssl/context_base.hpp	2013-05-17 06:57:02 EDT (Fri, 17 May 2013)
@@ -66,7 +66,25 @@
     sslv23_client,
 
     /// SSL/TLS server.
-    sslv23_server
+    sslv23_server,
+
+    /// Generic TLS version 1.1.
+    tlsv11,
+
+    /// TLS version 1.1 client.
+    tlsv11_client,
+
+    /// TLS version 1.1 server.
+    tlsv11_server,
+
+    /// Generic TLS version 1.2.
+    tlsv12,
+
+    /// TLS version 1.2 client.
+    tlsv12_client,
+
+    /// TLS version 1.2 server.
+    tlsv12_server
   };
 
   /// Bitmask type for SSL options.
Modified: trunk/boost/asio/ssl/impl/context.ipp
==============================================================================
--- trunk/boost/asio/ssl/impl/context.ipp	(original)
+++ trunk/boost/asio/ssl/impl/context.ipp	2013-05-17 06:57:02 EDT (Fri, 17 May 2013)
@@ -84,6 +84,42 @@
   case context::sslv23_server:
     handle_ = ::SSL_CTX_new(::SSLv23_server_method());
     break;
+#if defined(SSL_TXT_TLSV1_1)
+  case context::tlsv11:
+    handle_ = ::SSL_CTX_new(::TLSv1_1_method());
+    break;
+  case context::tlsv11_client:
+    handle_ = ::SSL_CTX_new(::TLSv1_1_client_method());
+    break;
+  case context::tlsv11_server:
+    handle_ = ::SSL_CTX_new(::TLSv1_1_server_method());
+    break;
+#else // defined(SSL_TXT_TLSV1_1)
+  case context::tlsv11:
+  case context::tlsv11_client:
+  case context::tlsv11_server:
+    boost::asio::detail::throw_error(
+        boost::asio::error::invalid_argument, "context");
+    break;
+#endif // defined(SSL_TXT_TLSV1_1)
+#if defined(SSL_TXT_TLSV1_2)
+  case context::tlsv12:
+    handle_ = ::SSL_CTX_new(::TLSv1_2_method());
+    break;
+  case context::tlsv12_client:
+    handle_ = ::SSL_CTX_new(::TLSv1_2_client_method());
+    break;
+  case context::tlsv12_server:
+    handle_ = ::SSL_CTX_new(::TLSv1_2_server_method());
+    break;
+#else // defined(SSL_TXT_TLSV1_2) 
+  case context::tlsv12:
+  case context::tlsv12_client:
+  case context::tlsv12_server:
+    boost::asio::detail::throw_error(
+        boost::asio::error::invalid_argument, "context");
+    break;
+#endif // defined(SSL_TXT_TLSV1_2) 
   default:
     handle_ = ::SSL_CTX_new(0);
     break;