diff --git a/include/libtorrent/torrent.hpp b/include/libtorrent/torrent.hpp index 1cbb3825d..c727720c5 100644 --- a/include/libtorrent/torrent.hpp +++ b/include/libtorrent/torrent.hpp @@ -47,6 +47,7 @@ POSSIBILITY OF SUCH DAMAGE. #include #include #include +#include #ifdef _MSC_VER #pragma warning(pop) @@ -954,7 +955,10 @@ namespace libtorrent #ifdef TORRENT_USE_OPENSSL boost::shared_ptr m_ssl_ctx; +#if BOOST_VERSION > 104600 bool verify_peer_cert(bool preverified, boost::asio::ssl::verify_context& ctx); +#endif + void init_ssl(std::string const& cert); #endif diff --git a/src/torrent.cpp b/src/torrent.cpp index 6c7e7be3d..db06a59ce 100644 --- a/src/torrent.cpp +++ b/src/torrent.cpp @@ -85,9 +85,11 @@ POSSIBILITY OF SUCH DAMAGE. #ifdef TORRENT_USE_OPENSSL #include "libtorrent/ssl_stream.hpp" #include +#if BOOST_VERSION > 104600 #include #include -#endif +#endif // BOOST_VERSION +#endif // TORRENT_USE_OPENSSL #if defined TORRENT_VERBOSE_LOGGING || defined TORRENT_LOGGING || defined TORRENT_ERROR_LOGGING #include "libtorrent/struct_debug.hpp" @@ -1287,6 +1289,7 @@ namespace libtorrent #ifdef TORRENT_USE_OPENSSL +#if BOOST_VERSION > 104600 bool torrent::verify_peer_cert(bool preverified, boost::asio::ssl::verify_context& ctx) { // if the cert wasn't signed by the correct CA, fail the verification @@ -1372,6 +1375,7 @@ namespace libtorrent return false; } +#endif // BOOST_VERSION void torrent::init_ssl(std::string const& cert) { @@ -1388,6 +1392,7 @@ namespace libtorrent TORRENT_ASSERT(RAND_status() == 1); +#if BOOST_VERSION > 104600 // create the SSL context for this torrent. We need to // inject the root certificate, and no other, to // verify other peers against @@ -1469,9 +1474,12 @@ namespace libtorrent #endif // if all went well, set the torrent ssl context to this one m_ssl_ctx = ctx; - // tell the client we need a cert for this torrent alerts().post_alert(torrent_need_cert_alert(get_handle())); +#else + set_error(asio::error::not_supported, "x.509 certificate"); + pause(); +#endif } #endif // TORRENT_OPENSSL