From: Matt Caswell Date: Mon, 26 Jul 2021 14:53:25 +0000 (+0100) Subject: Fix EVP_MD_meth_dup and EVP_CIPHER_meth_dup X-Git-Tag: openssl-3.0.0-beta2~16 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=bb98a1123b3d7a8464f2c1f61ffd41f826c7c423;p=thirdparty%2Fopenssl.git Fix EVP_MD_meth_dup and EVP_CIPHER_meth_dup Make sure the origin is set correctly when duping an EVP_MD or EVP_CIPHER. Fixes #16157 Reviewed-by: Dmitry Belyavskiy Reviewed-by: Paul Dale (Merged from https://github.com/openssl/openssl/pull/16159) --- diff --git a/crypto/evp/cmeth_lib.c b/crypto/evp/cmeth_lib.c index 9b935503071..a806ec5f9e2 100644 --- a/crypto/evp/cmeth_lib.c +++ b/crypto/evp/cmeth_lib.c @@ -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; } diff --git a/crypto/evp/evp_lib.c b/crypto/evp/evp_lib.c index f78df52ab19..64d7fb046de 100644 --- a/crypto/evp/evp_lib.c +++ b/crypto/evp/evp_lib.c @@ -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; }