aboutsummaryrefslogtreecommitdiff
path: root/src/common
diff options
context:
space:
mode:
Diffstat (limited to 'src/common')
-rw-r--r--src/common/Cryptography/Ed25519.cpp4
-rw-r--r--src/common/Cryptography/RSA.cpp6
-rw-r--r--src/common/Utilities/Memory.h4
3 files changed, 7 insertions, 7 deletions
diff --git a/src/common/Cryptography/Ed25519.cpp b/src/common/Cryptography/Ed25519.cpp
index ce706594057..6f286c74b3e 100644
--- a/src/common/Cryptography/Ed25519.cpp
+++ b/src/common/Cryptography/Ed25519.cpp
@@ -68,7 +68,7 @@ bool Ed25519::LoadFromFile(std::string const& fileName)
_key = nullptr;
}
- auto keyBIO = make_unique_ptr_with_deleter(BIO_new_file(fileName.c_str(), "r"), BIO_free);
+ auto keyBIO = make_unique_ptr_with_deleter(BIO_new_file(fileName.c_str(), "r"), &BIO_free);
if (!keyBIO)
return false;
@@ -89,7 +89,7 @@ bool Ed25519::LoadFromString(std::string const& keyPem)
auto keyBIO = make_unique_ptr_with_deleter(BIO_new_mem_buf(
const_cast<char*>(keyPem.c_str()) /*api hack - this function assumes memory is readonly but lacks const modifier*/,
- keyPem.length() + 1), BIO_free);
+ keyPem.length() + 1), &BIO_free);
if (!keyBIO)
return false;
diff --git a/src/common/Cryptography/RSA.cpp b/src/common/Cryptography/RSA.cpp
index eb85b6e5750..cef03fdc1bb 100644
--- a/src/common/Cryptography/RSA.cpp
+++ b/src/common/Cryptography/RSA.cpp
@@ -429,7 +429,7 @@ bool RsaSignature::LoadKeyFromFile(std::string const& fileName)
_key = nullptr;
}
- auto keyBIO = make_unique_ptr_with_deleter(BIO_new_file(fileName.c_str(), "r"), BIO_free);
+ auto keyBIO = make_unique_ptr_with_deleter(BIO_new_file(fileName.c_str(), "r"), &BIO_free);
if (!keyBIO)
return false;
@@ -450,7 +450,7 @@ bool RsaSignature::LoadKeyFromString(std::string const& keyPem)
auto keyBIO = make_unique_ptr_with_deleter(BIO_new_mem_buf(
const_cast<char*>(keyPem.c_str()) /*api hack - this function assumes memory is readonly but lacks const modifier*/,
- keyPem.length() + 1), BIO_free);
+ keyPem.length() + 1), &BIO_free);
if (!keyBIO)
return false;
@@ -466,7 +466,7 @@ bool RsaSignature::Sign(uint8 const* message, std::size_t messageLength, DigestG
std::unique_ptr<EVP_MD, DigestGenerator::EVP_MD_Deleter> digestGenerator = generator.GetGenerator();
#if OPENSSL_VERSION_NUMBER >= 0x30000000L
- auto keyCtx = make_unique_ptr_with_deleter(EVP_PKEY_CTX_new_from_pkey(generator.GetLib(), _key, nullptr), EVP_PKEY_CTX_free);
+ auto keyCtx = make_unique_ptr_with_deleter(EVP_PKEY_CTX_new_from_pkey(generator.GetLib(), _key, nullptr), &EVP_PKEY_CTX_free);
EVP_MD_CTX_set_pkey_ctx(_ctx, keyCtx.get());
std::unique_ptr<OSSL_PARAM[]> params = generator.GetParams();
diff --git a/src/common/Utilities/Memory.h b/src/common/Utilities/Memory.h
index 8d67e802104..98622166b22 100644
--- a/src/common/Utilities/Memory.h
+++ b/src/common/Utilities/Memory.h
@@ -27,7 +27,7 @@ namespace Impl
template<typename T, typename Del>
struct unique_ptr_deleter
{
- using pointer = T;
+ using pointer = T*;
unique_ptr_deleter(Del deleter) : _deleter(std::move(deleter)) { }
void operator()(pointer ptr) const { _deleter(ptr); }
@@ -38,7 +38,7 @@ private:
}
template<typename T, typename Del>
-auto make_unique_ptr_with_deleter(T ptr, Del&& deleter)
+auto make_unique_ptr_with_deleter(T* ptr, Del&& deleter)
{
using Deleter_t = Impl::unique_ptr_deleter<T, Del>;