aboutsummaryrefslogtreecommitdiff
path: root/src/common/Cryptography/RSA.cpp
diff options
context:
space:
mode:
authorShauren <shauren.trinity@gmail.com>2024-10-01 21:03:44 +0200
committerShauren <shauren.trinity@gmail.com>2024-10-01 21:03:44 +0200
commitb13b5142f1009a71ff06786ac8c8db92891f566a (patch)
treeda6b6ab4b0b47e5ac9b219507c9049c4b59d798b /src/common/Cryptography/RSA.cpp
parent0d496b14d54d723090ea36760ee0e8d47e53891c (diff)
Core/Utilities: Extend make_unique_ptr_with_deleter functionality to allow it to create deleters with compile time constant functions (reduces its size to just sizeof(void*))
Diffstat (limited to 'src/common/Cryptography/RSA.cpp')
-rw-r--r--src/common/Cryptography/RSA.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/common/Cryptography/RSA.cpp b/src/common/Cryptography/RSA.cpp
index 106eed27374..27a0f750fb0 100644
--- a/src/common/Cryptography/RSA.cpp
+++ b/src/common/Cryptography/RSA.cpp
@@ -297,7 +297,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_free>(BIO_new_file(fileName.c_str(), "r"));
if (!keyBIO)
return false;
@@ -316,9 +316,9 @@ bool RsaSignature::LoadKeyFromString(std::string const& keyPem)
_key = nullptr;
}
- auto keyBIO = make_unique_ptr_with_deleter(BIO_new_mem_buf(
+ auto keyBIO = make_unique_ptr_with_deleter<&BIO_free>(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));
if (!keyBIO)
return false;
@@ -333,7 +333,7 @@ bool RsaSignature::Sign(uint8 const* message, std::size_t messageLength, DigestG
{
std::unique_ptr<EVP_MD, DigestGenerator::EVP_MD_Deleter> digestGenerator = generator.GetGenerator();
- 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_free>(EVP_PKEY_CTX_new_from_pkey(generator.GetLib(), _key, nullptr));
EVP_MD_CTX_set_pkey_ctx(_ctx, keyCtx.get());
std::unique_ptr<OSSL_PARAM[]> params = generator.GetParams();