From: Dmitry Belyavskiy Date: Mon, 7 Feb 2022 17:31:04 +0000 (+0100) Subject: Ensure that CMAC_ACPKM_CTX_copy works with 2 non-NULL pointers - fixup X-Git-Tag: v3.0.1~6 X-Git-Url: http://wagner.pp.ru/gitweb/?a=commitdiff_plain;h=374627ab520fca0a189d56a747abbff7e2b67bd7;p=openssl-gost%2Fengine.git Ensure that CMAC_ACPKM_CTX_copy works with 2 non-NULL pointers - fixup Related: #387 --- diff --git a/gost_omac_acpkm.c b/gost_omac_acpkm.c index 507ca53..8e2c4df 100644 --- a/gost_omac_acpkm.c +++ b/gost_omac_acpkm.c @@ -98,7 +98,7 @@ static void CMAC_ACPKM_CTX_free(CMAC_ACPKM_CTX *ctx) OPENSSL_free(ctx); } -int CMAC_ACPKM_CTX_copy(CMAC_ACPKM_CTX *out, const CMAC_ACPKM_CTX *in) +static int CMAC_ACPKM_CTX_copy(CMAC_ACPKM_CTX *out, const CMAC_ACPKM_CTX *in) { int bl; if (in->nlast_block == -1) @@ -375,7 +375,8 @@ static int omac_acpkm_imit_copy(EVP_MD_CTX *to, const EVP_MD_CTX *from) 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); + + return (c_to->cmac_ctx) ? CMAC_ACPKM_CTX_copy(c_to->cmac_ctx, c_from->cmac_ctx) : 0; } /* Clean up imit ctx */