dhtproxy: patch client renegotiation

This commit is contained in:
Seva authored and Adrien Béraud committed 2019-08-20 10:45:05 -04:00
1 parent d551b8a54c
commit d214bfebf5
1 file changed
+7 -4
+7 -4
View File
@@ -116,15 +116,18 @@ DhtProxyServer::DhtProxyServer(
jsonBuilder_["indentation"] = "";
if (identity.first and identity.second) {
asio::error_code ec;
// define tls context
asio::ssl::context tls_context { asio::ssl::context::sslv23 };
tls_context.set_options(asio::ssl::context::default_workarounds
| asio::ssl::context::no_sslv2
| asio::ssl::context::single_dh_use);
// save keys in memory & set in tls context
asio::error_code ec;
| asio::ssl::context::single_dh_use, ec);
if (ec)
throw std::runtime_error("Error setting tls context options: " + ec.message());
// add more security options
SSL_CTX_set_options(tls_context.native_handle(), SSL_OP_NO_RENEGOTIATION); // CVE-2009-3555
// node private key
auto pk = identity.first->serialize(); // returns Blob
auto pk = identity.first->serialize();
pk_ = std::make_unique<asio::const_buffer>(static_cast<void*>(pk.data()), (std::size_t) pk.size());
tls_context.use_private_key(*pk_, asio::ssl::context::file_format::pem, ec);
if (ec)