From 2c54544b48de2998eb657c89bce74d28751adec9 Mon Sep 17 00:00:00 2001 From: Dmitry Belyavskiy Date: Sun, 6 Feb 2022 14:41:15 +0100 Subject: [PATCH] Ensure that CMAC_ACPKM_CTX_copy works with 2 non-NULL pointers. Related: #387 --- gost_omac_acpkm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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); -- 2.39.5