diff options
author | luigi1111 <luigi1111w@gmail.com> | 2021-08-11 22:38:24 -0400 |
---|---|---|
committer | luigi1111 <luigi1111w@gmail.com> | 2021-08-11 22:38:24 -0400 |
commit | 0b4e9221591878fc0ceea1ca5a8bc646e159c368 (patch) | |
tree | f29a5c11c1605e9fbdc898feb036b7522bc10b9b | |
parent | Merge pull request #7811 (diff) | |
parent | Make SSL key/cert storage backward-compatible (diff) | |
download | monero-0b4e9221591878fc0ceea1ca5a8bc646e159c368.tar.xz |
Merge pull request #7812
bf96055 Make SSL key/cert storage backward-compatible (Nathan Dorfman)
-rw-r--r-- | contrib/epee/src/net_ssl.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/contrib/epee/src/net_ssl.cpp b/contrib/epee/src/net_ssl.cpp index 765dadce3..70cd0d0ad 100644 --- a/contrib/epee/src/net_ssl.cpp +++ b/contrib/epee/src/net_ssl.cpp @@ -576,7 +576,8 @@ boost::system::error_code store_ssl_keys(boost::asio::ssl::context& ssl, const b 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(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()}; using file_closer = int(std::FILE*); |