aboutsummaryrefslogtreecommitdiff
path: root/src/common/Cryptography/HMAC.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/common/Cryptography/HMAC.h')
-rw-r--r--src/common/Cryptography/HMAC.h5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/common/Cryptography/HMAC.h b/src/common/Cryptography/HMAC.h
index 6ed86de4bab..d07ba19216d 100644
--- a/src/common/Cryptography/HMAC.h
+++ b/src/common/Cryptography/HMAC.h
@@ -86,9 +86,10 @@ namespace Trinity::Impl
if (this == &right)
return *this;
- int result = EVP_MD_CTX_copy(_ctx, right._ctx);
+ int result = EVP_MD_CTX_copy_ex(_ctx, right._ctx);
ASSERT(result == 1);
- _key = right._key; // EVP_PKEY uses reference counting internally, just copy the pointer
+ _key = right._key; // EVP_PKEY uses reference counting internally, just copy the pointer
+ EVP_PKEY_up_ref(_key); // Bump reference count for PKEY, as every instance of this class holds two references to PKEY and destructor decrements it twice
_digest = right._digest;
return *this;
}