Skip to content

Commit

Permalink
Ensure that CMAC_ACPKM_CTX_copy works with 2 non-NULL pointers - fixup
Browse files Browse the repository at this point in the history
Related: #387
  • Loading branch information
beldmit committed Feb 7, 2022
1 parent 2c54544 commit 374627a
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions gost_omac_acpkm.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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 */
Expand Down

0 comments on commit 374627a

Please sign in to comment.