diff --git a/include/libtorrent/ssl_stream.hpp b/include/libtorrent/ssl_stream.hpp index f2a225e4e..b6837fd48 100644 --- a/include/libtorrent/ssl_stream.hpp +++ b/include/libtorrent/ssl_stream.hpp @@ -63,7 +63,11 @@ public: typedef typename Stream::protocol_type protocol_type; void set_host_name(std::string name) - { SSL_set_tlsext_host_name(m_sock.native_handle(), name.c_str()); } + { +#if OPENSSL_VERSION_NUMBER >= 0x90812f + SSL_set_tlsext_host_name(m_sock.native_handle(), name.c_str()); +#endif + } template void set_verify_callback(T const& fun, error_code& ec) diff --git a/src/session_impl.cpp b/src/session_impl.cpp index 00cb12ea1..bf3e80ccd 100644 --- a/src/session_impl.cpp +++ b/src/session_impl.cpp @@ -541,7 +541,7 @@ namespace aux { int session_impl::logging_allocator::allocated_bytes = 0; #endif -#if defined TORRENT_USE_OPENSSL && BOOST_VERSION >= 104700 +#if defined TORRENT_USE_OPENSSL && BOOST_VERSION >= 104700 && OPENSSL_VERSION_NUMBER >= 0x90812f // when running bittorrent over SSL, the SNI (server name indication) // extension is used to know which torrent the incoming connection is // trying to connect to. The 40 first bytes in the name is expected to @@ -689,8 +689,10 @@ namespace aux { #ifdef TORRENT_USE_OPENSSL m_ssl_ctx.set_verify_mode(asio::ssl::context::verify_none, ec); #if BOOST_VERSION >= 104700 +#if OPENSSL_VERSION_NUMBER >= 0x90812f SSL_CTX_set_tlsext_servername_callback(m_ssl_ctx.native_handle(), servername_callback); SSL_CTX_set_tlsext_servername_arg(m_ssl_ctx.native_handle(), this); +#endif // OPENSSL_VERSION_NUMBER #endif // BOOST_VERSION #endif diff --git a/src/socket_type.cpp b/src/socket_type.cpp index a84dc1187..24cde253c 100644 --- a/src/socket_type.cpp +++ b/src/socket_type.cpp @@ -84,11 +84,14 @@ namespace libtorrent } #undef CASE +#if OPENSSL_VERSION_NUMBER >= 0x90812f if (ctx) { SSL_CTX_set_tlsext_servername_callback(ctx, 0); SSL_CTX_set_tlsext_servername_arg(ctx, 0); } +#endif // OPENSSL_VERSION_NUMBER + #endif }