]> www.wagner.pp.ru Git - openssl-gost/engine.git/commitdiff
Ensure that CMAC_ACPKM_CTX_copy works with 2 non-NULL pointers.
authorDmitry Belyavskiy <beldmit@gmail.com>
Sun, 6 Feb 2022 13:41:15 +0000 (14:41 +0100)
committerDmitry Belyavskiy <beldmit@gmail.com>
Sun, 6 Feb 2022 13:41:15 +0000 (14:41 +0100)
Related: #387

gost_omac_acpkm.c

index cec683fb34637a393fa09049f490cd3c78eafa89..507ca53532d5684be92117679908bcfd6b9047b0 100644 (file)
@@ -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);