mirror of
https://github.com/monero-project/monero.git
synced 2024-11-17 00:07:38 +00:00
Make SSL key/cert storage backward-compatible
This is required to build on OpenBSD (which uses LibreSSL). It also allows building against versions of OpenSSL before 1.0.2.
This commit is contained in:
parent
de3456e127
commit
bf96055211
1 changed files with 2 additions and 1 deletions
|
@ -576,7 +576,8 @@ boost::system::error_code store_ssl_keys(boost::asio::ssl::context& ssl, const b
|
||||||
const auto ctx = ssl.native_handle();
|
const auto ctx = ssl.native_handle();
|
||||||
CHECK_AND_ASSERT_MES(ctx, boost::system::error_code(EINVAL, boost::system::system_category()), "Context is null");
|
CHECK_AND_ASSERT_MES(ctx, boost::system::error_code(EINVAL, boost::system::system_category()), "Context is null");
|
||||||
CHECK_AND_ASSERT_MES(base.has_filename(), boost::system::error_code(EINVAL, boost::system::system_category()), "Need filename");
|
CHECK_AND_ASSERT_MES(base.has_filename(), boost::system::error_code(EINVAL, boost::system::system_category()), "Need filename");
|
||||||
if (!(ssl_key = SSL_CTX_get0_privatekey(ctx)) || !(ssl_cert = SSL_CTX_get0_certificate(ctx)))
|
std::unique_ptr<SSL, decltype(&SSL_free)> dflt_SSL(SSL_new(ctx), SSL_free);
|
||||||
|
if (!dflt_SSL || !(ssl_key = SSL_get_privatekey(dflt_SSL.get())) || !(ssl_cert = SSL_get_certificate(dflt_SSL.get())))
|
||||||
return {EINVAL, boost::system::system_category()};
|
return {EINVAL, boost::system::system_category()};
|
||||||
|
|
||||||
using file_closer = int(std::FILE*);
|
using file_closer = int(std::FILE*);
|
||||||
|
|
Loading…
Reference in a new issue