--- boost/asio/ssl/detail/engine.hpp +++ boost/asio/ssl/detail/engine.hpp 15-11-19 04:00:51 @@ -146,6 +146,9 @@ // Adapt the SSL_write function to the signature needed for perform(). BOOST_ASIO_DECL int do_write(void* data, std::size_t length); + // Adapt the SSL_do_handshake function to the signature needed for perform(). + BOOST_ASIO_DECL int do_handshake(void* data, std::size_t length); + SSL* ssl_; BIO* ext_bio_; }; --- boost/asio/ssl/detail/impl/engine.ipp +++ boost/asio/ssl/detail/impl/engine.ipp 15-11-19 04:08:36 @@ -134,8 +134,16 @@ engine::want engine::handshake( stream_base::handshake_type type, boost::system::error_code& ec) { - return perform((type == boost::asio::ssl::stream_base::client) - ? &engine::do_connect : &engine::do_accept, 0, 0, ec, 0); + switch (type) + { + case boost::asio::ssl::stream_base::client: + return perform(&engine::do_connect, 0, 0, ec, 0); + case boost::asio::ssl::stream_base::server: + return perform(&engine::do_accept, 0, 0, ec, 0); + case boost::asio::ssl::stream_base::renegotiate: + ::SSL_renegotiate(ssl_); + return perform(&engine::do_handshake, 0, 0, ec, 0); + } } engine::want engine::shutdown(boost::system::error_code& ec) @@ -316,6 +324,11 @@ length < INT_MAX ? static_cast(length) : INT_MAX); } +int engine::do_handshake(void*, std::size_t) +{ + return ::SSL_do_handshake(ssl_); +} + #endif // !defined(BOOST_ASIO_ENABLE_OLD_SSL) } // namespace detail --- boost/asio/ssl/stream_base.hpp +++ boost/asio/ssl/stream_base.hpp 15-11-19 04:14:30 @@ -35,7 +35,10 @@ client, /// Perform handshaking as a server. - server + server, + + /// Perform renegotiation handshake. + renegotiate }; protected: