From: Vitaly Chikunov Date: Thu, 2 Aug 2018 18:41:02 +0000 (+0300) Subject: Allow EVP_MD_CTX_copy_ex OMAC before key is set X-Git-Tag: v3.0.0~385 X-Git-Url: http://wagner.pp.ru/gitweb/?a=commitdiff_plain;h=e0816ed2014bad0e5293cafcce2c07a66a4f1cb0;p=openssl-gost%2Fengine.git Allow EVP_MD_CTX_copy_ex OMAC before key is set Reported-by: Gleb Fotengauer-Malinovskiy --- diff --git a/gost_omac.c b/gost_omac.c index d1f897a..e78fd9d 100644 --- a/gost_omac.c +++ b/gost_omac.c @@ -92,6 +92,13 @@ int omac_imit_copy(EVP_MD_CTX *to, const EVP_MD_CTX *from) { return 0; } + if (!c_from->cmac_ctx) { + if (c_to->cmac_ctx) { + CMAC_CTX_free(c_to->cmac_ctx); + c_to->cmac_ctx = NULL; + } + return 1; + } if (c_to->cmac_ctx == c_from->cmac_ctx) { c_to->cmac_ctx = CMAC_CTX_new();