From c29e14e697c6194bf26b043634b34ede79659f82 Mon Sep 17 00:00:00 2001 From: olszomal Date: Thu, 12 Jan 2023 15:25:42 +0100 Subject: [PATCH] Reset calculated message digest, CID 1519395 --- msi.c | 1 - osslsigncode.c | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/msi.c b/msi.c index ab3431a..5093a87 100644 --- a/msi.c +++ b/msi.c @@ -745,7 +745,6 @@ int msi_calc_digest(char *indata, int mdtype, u_char *mdbuf, uint32_t fileend) printf("Unable to set up the digest context\n"); goto out; } - memset(mdbuf, 0, EVP_MAX_MD_SIZE); (void)BIO_seek(bio, 0); n = 0; diff --git a/osslsigncode.c b/osslsigncode.c index c333059..450424b 100644 --- a/osslsigncode.c +++ b/osslsigncode.c @@ -3385,7 +3385,6 @@ static int pe_calc_digest(char *indata, int mdtype, u_char *mdbuf, FILE_HEADER * printf("Unable to set up the digest context\n"); goto err; } - memset(mdbuf, 0, EVP_MAX_MD_SIZE); bio = BIO_new(BIO_s_mem()); i = n = header->header_size + 88 + 4 + 60 + header->pe32plus * 16 + 8; if (!BIO_write_ex(bio, indata, i, &written) || written != i) @@ -3852,7 +3851,6 @@ static int cab_calc_digest(char *indata, int mdtype, u_char *mdbuf, FILE_HEADER printf("Unable to set up the digest context\n"); goto err; } - memset(mdbuf, 0, EVP_MAX_MD_SIZE); left = offset; if (left > SIZE_64K) left = SIZE_64K; @@ -4438,6 +4436,8 @@ static int cat_verify_member(CatalogAuthAttr *attribute, char *indata, FILE_HEAD printf("Failed to extract current message digest\n\n"); goto out; } + /* reset calculated message digest */ + memset(cmdbuf, 0, EVP_MAX_MD_SIZE); /* compute a message digest of the input file */ switch (filetype) { case FILE_TYPE_CAB: