X-Git-Url: http://wagner.pp.ru/gitweb/?a=blobdiff_plain;f=gost_omac_acpkm.c;h=8e2c4df384343d73ce9fde474e5e83b0fb13d039;hb=3dddb788511c758e2d851226e75aa01d23c14190;hp=cec683fb34637a393fa09049f490cd3c78eafa89;hpb=27d1f87c77844f58e13805c0c4bed3d373f1ee07;p=openssl-gost%2Fengine.git diff --git a/gost_omac_acpkm.c b/gost_omac_acpkm.c index cec683f..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) @@ -372,10 +372,11 @@ 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); + + return (c_to->cmac_ctx) ? CMAC_ACPKM_CTX_copy(c_to->cmac_ctx, c_from->cmac_ctx) : 0; } /* Clean up imit ctx */