From da2b9884c60666584b25f2a34d078c9c1e69a151 Mon Sep 17 00:00:00 2001 From: Raman Budny Date: Wed, 20 Apr 2016 13:51:50 +0000 Subject: [PATCH] Fix boringssl support. --- include/boost/asio/ssl/detail/impl/engine.ipp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/include/boost/asio/ssl/detail/impl/engine.ipp b/include/boost/asio/ssl/detail/impl/engine.ipp index 3fcfd70d..13aff854 100644 --- a/include/boost/asio/ssl/detail/impl/engine.ipp +++ b/include/boost/asio/ssl/detail/impl/engine.ipp @@ -203,9 +203,15 @@ const boost::system::error_code& engine::map_error_code( // If there's data yet to be read, it's an error. if (BIO_wpending(ext_bio_)) { +#if defined(OPENSSL_IS_BORINGSSL) + ec = boost::system::error_code( + ERR_PACK(ERR_LIB_SSL, SSL_R_UNEXPECTED_RECORD), + boost::asio::error::get_ssl_category()); +#else ec = boost::system::error_code( ERR_PACK(ERR_LIB_SSL, 0, SSL_R_SHORT_READ), boost::asio::error::get_ssl_category()); +#endif // defined(OPENSSL_IS_BORINGSSL) return ec; } @@ -217,9 +223,15 @@ const boost::system::error_code& engine::map_error_code( // Otherwise, the peer should have negotiated a proper shutdown. if ((::SSL_get_shutdown(ssl_) & SSL_RECEIVED_SHUTDOWN) == 0) { +#if defined(OPENSSL_IS_BORINGSSL) + ec = boost::system::error_code( + ERR_PACK(ERR_LIB_SSL, SSL_R_UNEXPECTED_RECORD), + boost::asio::error::get_ssl_category()); +#else ec = boost::system::error_code( ERR_PACK(ERR_LIB_SSL, 0, SSL_R_SHORT_READ), boost::asio::error::get_ssl_category()); +#endif // defined(OPENSSL_IS_BORINGSSL) } return ec;