summaryrefslogtreecommitdiff
path: root/boost/asio/ssl
diff options
context:
space:
mode:
authorDongHun Kwak <dh0128.kwak@samsung.com>2019-12-05 15:21:30 +0900
committerDongHun Kwak <dh0128.kwak@samsung.com>2019-12-05 15:21:30 +0900
commitd6a306e745acfee00e81ccaf3324a2a03516db41 (patch)
tree145a26368608982f40ebb0f4836185c44abb9ae4 /boost/asio/ssl
parent5ce2ccf2f23c6d3de4c79f216f57ca6f2a18ed16 (diff)
downloadboost-d6a306e745acfee00e81ccaf3324a2a03516db41.tar.gz
boost-d6a306e745acfee00e81ccaf3324a2a03516db41.tar.bz2
boost-d6a306e745acfee00e81ccaf3324a2a03516db41.zip
Imported Upstream version 1.69.0upstream/1.69.0
Diffstat (limited to 'boost/asio/ssl')
-rw-r--r--boost/asio/ssl/context_base.hpp17
-rw-r--r--boost/asio/ssl/impl/context.ipp55
-rw-r--r--boost/asio/ssl/stream.hpp3
3 files changed, 69 insertions, 6 deletions
diff --git a/boost/asio/ssl/context_base.hpp b/boost/asio/ssl/context_base.hpp
index 8671ee676a..625ccc7b5b 100644
--- a/boost/asio/ssl/context_base.hpp
+++ b/boost/asio/ssl/context_base.hpp
@@ -86,6 +86,15 @@ public:
/// TLS version 1.2 server.
tlsv12_server,
+ /// Generic TLS version 1.3.
+ tlsv13,
+
+ /// TLS version 1.3 client.
+ tlsv13_client,
+
+ /// TLS version 1.3 server.
+ tlsv13_server,
+
/// Generic TLS.
tls,
@@ -121,6 +130,9 @@ public:
/// Disable TLS v1.2.
static const long no_tlsv1_2 = implementation_defined;
+ /// Disable TLS v1.3.
+ static const long no_tlsv1_3 = implementation_defined;
+
/// Disable compression. Compression is disabled by default.
static const long no_compression = implementation_defined;
#else
@@ -139,6 +151,11 @@ public:
# else // defined(SSL_OP_NO_TLSv1_2)
BOOST_ASIO_STATIC_CONSTANT(long, no_tlsv1_2 = 0x08000000L);
# endif // defined(SSL_OP_NO_TLSv1_2)
+# if defined(SSL_OP_NO_TLSv1_3)
+ BOOST_ASIO_STATIC_CONSTANT(long, no_tlsv1_3 = SSL_OP_NO_TLSv1_3);
+# else // defined(SSL_OP_NO_TLSv1_3)
+ BOOST_ASIO_STATIC_CONSTANT(long, no_tlsv1_3 = 0x20000000L);
+# endif // defined(SSL_OP_NO_TLSv1_3)
# if defined(SSL_OP_NO_COMPRESSION)
BOOST_ASIO_STATIC_CONSTANT(long, no_compression = SSL_OP_NO_COMPRESSION);
# else // defined(SSL_OP_NO_COMPRESSION)
diff --git a/boost/asio/ssl/impl/context.ipp b/boost/asio/ssl/impl/context.ipp
index f35e43c2a6..b331dea45d 100644
--- a/boost/asio/ssl/impl/context.ipp
+++ b/boost/asio/ssl/impl/context.ipp
@@ -158,7 +158,7 @@ context::context(context::method m)
SSL_CTX_set_max_proto_version(handle_, TLS1_VERSION);
}
break;
-#else // (OPENSSL_VERSION_NUMBER >= 0x10100000L)
+#elif defined(SSL_TXT_TLSV1)
case context::tlsv1:
handle_ = ::SSL_CTX_new(::TLSv1_method());
break;
@@ -168,7 +168,14 @@ context::context(context::method m)
case context::tlsv1_server:
handle_ = ::SSL_CTX_new(::TLSv1_server_method());
break;
-#endif // (OPENSSL_VERSION_NUMBER >= 0x10100000L)
+#else // defined(SSL_TXT_TLSV1)
+ case context::tlsv1:
+ case context::tlsv1_client:
+ case context::tlsv1_server:
+ boost::asio::detail::throw_error(
+ boost::asio::error::invalid_argument, "context");
+ break;
+#endif // defined(SSL_TXT_TLSV1)
// TLS v1.1.
#if (OPENSSL_VERSION_NUMBER >= 0x10100000L) && !defined(LIBRESSL_VERSION_NUMBER)
@@ -241,7 +248,7 @@ context::context(context::method m)
SSL_CTX_set_max_proto_version(handle_, TLS1_2_VERSION);
}
break;
-#elif defined(SSL_TXT_TLSV1_1)
+#elif defined(SSL_TXT_TLSV1_2)
case context::tlsv12:
handle_ = ::SSL_CTX_new(::TLSv1_2_method());
break;
@@ -251,14 +258,52 @@ context::context(context::method m)
case context::tlsv12_server:
handle_ = ::SSL_CTX_new(::TLSv1_2_server_method());
break;
-#else // defined(SSL_TXT_TLSV1_1)
+#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_1)
+#endif // defined(SSL_TXT_TLSV1_2)
+
+ // TLS v1.3.
+#if (OPENSSL_VERSION_NUMBER >= 0x10101000L) \
+ && !defined(LIBRESSL_VERSION_NUMBER)
+ case context::tlsv13:
+ handle_ = ::SSL_CTX_new(::TLS_method());
+ if (handle_)
+ {
+ SSL_CTX_set_min_proto_version(handle_, TLS1_3_VERSION);
+ SSL_CTX_set_max_proto_version(handle_, TLS1_3_VERSION);
+ }
+ break;
+ case context::tlsv13_client:
+ handle_ = ::SSL_CTX_new(::TLS_client_method());
+ if (handle_)
+ {
+ SSL_CTX_set_min_proto_version(handle_, TLS1_3_VERSION);
+ SSL_CTX_set_max_proto_version(handle_, TLS1_3_VERSION);
+ }
+ break;
+ case context::tlsv13_server:
+ handle_ = ::SSL_CTX_new(::TLS_server_method());
+ if (handle_)
+ {
+ SSL_CTX_set_min_proto_version(handle_, TLS1_3_VERSION);
+ SSL_CTX_set_max_proto_version(handle_, TLS1_3_VERSION);
+ }
+ break;
+#else // (OPENSSL_VERSION_NUMBER >= 0x10101000L)
+ // && !defined(LIBRESSL_VERSION_NUMBER)
+ case context::tlsv13:
+ case context::tlsv13_client:
+ case context::tlsv13_server:
+ boost::asio::detail::throw_error(
+ boost::asio::error::invalid_argument, "context");
+ break;
+#endif // (OPENSSL_VERSION_NUMBER >= 0x10101000L)
+ // && !defined(LIBRESSL_VERSION_NUMBER)
// Any supported SSL/TLS version.
case context::sslv23:
diff --git a/boost/asio/ssl/stream.hpp b/boost/asio/ssl/stream.hpp
index 005ff465f4..1acaceea45 100644
--- a/boost/asio/ssl/stream.hpp
+++ b/boost/asio/ssl/stream.hpp
@@ -635,7 +635,8 @@ public:
*
* @note The async_write_some operation may not transmit all of the data to
* the peer. Consider using the @ref async_write function if you need to
- * ensure that all data is written before the blocking operation completes.
+ * ensure that all data is written before the asynchronous operation
+ * completes.
*/
template <typename ConstBufferSequence, typename WriteHandler>
BOOST_ASIO_INITFN_RESULT_TYPE(WriteHandler,