From: Dmitry Belyavskiy Date: Sun, 6 Feb 2022 13:41:15 +0000 (+0100) Subject: Ensure that CMAC_ACPKM_CTX_copy works with 2 non-NULL pointers. X-Git-Tag: v3.0.1~7 X-Git-Url: http://wagner.pp.ru/gitweb/?a=commitdiff_plain;h=2c54544b48de2998eb657c89bce74d28751adec9;p=openssl-gost%2Fengine.git Ensure that CMAC_ACPKM_CTX_copy works with 2 non-NULL pointers. Related: #387 --- diff --git a/gost_omac_acpkm.c b/gost_omac_acpkm.c index cec683f..507ca53 100644 --- a/gost_omac_acpkm.c +++ b/gost_omac_acpkm.c @@ -372,7 +372,7 @@ static int omac_acpkm_imit_copy(EVP_MD_CTX *to, const EVP_MD_CTX *from) } return 1; } - if (c_to->cmac_ctx == c_from->cmac_ctx) { + if ((c_to->cmac_ctx == c_from->cmac_ctx) || (c_to->cmac_ctx == NULL)) { c_to->cmac_ctx = CMAC_ACPKM_CTX_new(); } return CMAC_ACPKM_CTX_copy(c_to->cmac_ctx, c_from->cmac_ctx);