]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/boost/boost/asio/ssl/detail/impl/engine.ipp
update ceph source to reef 18.1.2
[ceph.git] / ceph / src / boost / boost / asio / ssl / detail / impl / engine.ipp
index c377ab76b2b67232320d3e7c67e76237271d7e06..ea373ad86a2fc9c6dad4a7225aaf45c6b05a309a 100644 (file)
@@ -2,7 +2,7 @@
 // ssl/detail/impl/engine.ipp
 // ~~~~~~~~~~~~~~~~~~~~~~~~~~
 //
-// Copyright (c) 2003-2020 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2022 Christopher M. Kohlhoff (chris at kohlhoff dot com)
 //
 // Distributed under the Boost Software License, Version 1.0. (See accompanying
 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@@ -56,6 +56,24 @@ engine::engine(SSL_CTX* context)
   ::SSL_set_bio(ssl_, int_bio, int_bio);
 }
 
+engine::engine(SSL* ssl_impl)
+  : ssl_(ssl_impl)
+{
+#if (OPENSSL_VERSION_NUMBER < 0x10000000L)
+  accept_mutex().init();
+#endif // (OPENSSL_VERSION_NUMBER < 0x10000000L)
+
+  ::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);
+}
+
 #if defined(BOOST_ASIO_HAS_MOVE)
 engine::engine(engine&& other) BOOST_ASIO_NOEXCEPT
   : ssl_(other.ssl_),
@@ -81,6 +99,20 @@ engine::~engine()
     ::SSL_free(ssl_);
 }
 
+#if defined(BOOST_ASIO_HAS_MOVE)
+engine& engine::operator=(engine&& other) BOOST_ASIO_NOEXCEPT
+{
+  if (this != &other)
+  {
+    ssl_ = other.ssl_;
+    ext_bio_ = other.ext_bio_;
+    other.ssl_ = 0;
+    other.ext_bio_ = 0;
+  }
+  return *this;
+}
+#endif // defined(BOOST_ASIO_HAS_MOVE)
+
 SSL* engine::native_handle()
 {
   return ssl_;