Ticket #11809: asio_ssl_renegotiate.patch

File asio_ssl_renegotiate.patch, 1.7 KB (added by georgid@…, 7 years ago)

Patch that adds support for SSL renegotiate handshake

  • boost/asio/ssl/detail/engine.hpp

     
    146146  // Adapt the SSL_write function to the signature needed for perform().
    147147  BOOST_ASIO_DECL int do_write(void* data, std::size_t length);
    148148
     149  // Adapt the SSL_do_handshake function to the signature needed for perform().
     150  BOOST_ASIO_DECL int do_handshake(void* data, std::size_t length);
     151
    149152  SSL* ssl_;
    150153  BIO* ext_bio_;
    151154};
  • boost/asio/ssl/detail/impl/engine.ipp

     
    134134engine::want engine::handshake(
    135135    stream_base::handshake_type type, boost::system::error_code& ec)
    136136{
    137   return perform((type == boost::asio::ssl::stream_base::client)
    138       ? &engine::do_connect : &engine::do_accept, 0, 0, ec, 0);
     137   switch (type)
     138   {
     139   case boost::asio::ssl::stream_base::client:
     140      return perform(&engine::do_connect, 0, 0, ec, 0);
     141   case boost::asio::ssl::stream_base::server:
     142      return perform(&engine::do_accept, 0, 0, ec, 0);
     143   case boost::asio::ssl::stream_base::renegotiate:
     144      ::SSL_renegotiate(ssl_);
     145      return perform(&engine::do_handshake, 0, 0, ec, 0);
     146   }
    139147}
    140148
    141149engine::want engine::shutdown(boost::system::error_code& ec)
     
    316324      length < INT_MAX ? static_cast<int>(length) : INT_MAX);
    317325}
    318326
     327int engine::do_handshake(void*, std::size_t)
     328{
     329  return ::SSL_do_handshake(ssl_);
     330}
     331
    319332#endif // !defined(BOOST_ASIO_ENABLE_OLD_SSL)
    320333
    321334} // namespace detail
  • boost/asio/ssl/stream_base.hpp

     
    3535    client,
    3636
    3737    /// Perform handshaking as a server.
    38     server
     38    server,
     39
     40    /// Perform renegotiation handshake.
     41    renegotiate
    3942  };
    4043
    4144protected: