]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
Fix EVP_MD_meth_dup and EVP_CIPHER_meth_dup
authorMatt Caswell <matt@openssl.org>
Mon, 26 Jul 2021 14:53:25 +0000 (15:53 +0100)
committerPauli <pauli@openssl.org>
Tue, 27 Jul 2021 23:36:54 +0000 (09:36 +1000)
Make sure the origin is set correctly when duping an EVP_MD or EVP_CIPHER.

Fixes #16157

Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/16159)

crypto/evp/cmeth_lib.c
crypto/evp/evp_lib.c

index 9b935503071ee005337f46f93258735d0e3ed900..a806ec5f9e22088585dba3e0cafa42d6f1022d89 100644 (file)
@@ -50,6 +50,7 @@ EVP_CIPHER *EVP_CIPHER_meth_dup(const EVP_CIPHER *cipher)
 
         memcpy(to, cipher, sizeof(*to));
         to->lock = lock;
+        to->origin = EVP_ORIG_METH;
     }
     return to;
 }
index f78df52ab1953c905728ff8acfe60041d56e2ac7..64d7fb046de9c75d1f72ab0f01f6b0c8da89bbfb 100644 (file)
@@ -823,6 +823,7 @@ EVP_MD *EVP_MD_meth_dup(const EVP_MD *md)
 
         memcpy(to, md, sizeof(*to));
         to->lock = lock;
+        to->origin = EVP_ORIG_METH;
     }
     return to;
 }