memset 0 the temp contexts

This commit is contained in:
night1rider
2026-02-24 16:20:28 -07:00
parent 58a6158c4e
commit 455b3c6b03
3 changed files with 9 additions and 0 deletions
+4
View File
@@ -12372,6 +12372,7 @@ static int BuildMD5(WOLFSSL* ssl, Hashes* hashes, const byte* sender)
#else
wc_Md5 md5[1];
#endif
XMEMSET(md5, 0, sizeof(wc_Md5));
/* make md5 inner */
ret = wc_Md5Copy(&ssl->hsHashes->hashMd5, md5);
@@ -12417,6 +12418,7 @@ static int BuildSHA(WOLFSSL* ssl, Hashes* hashes, const byte* sender)
#else
wc_Sha sha[1];
#endif
XMEMSET(sha, 0, sizeof(wc_Sha));
/* make sha inner */
ret = wc_ShaCopy(&ssl->hsHashes->hashSha, sha); /* Save current position */
if (ret == 0)
@@ -23926,6 +23928,7 @@ static int BuildMD5_CertVerify(const WOLFSSL* ssl, byte* digest)
#else
wc_Md5 md5[1];
#endif
XMEMSET(md5, 0, sizeof(wc_Md5));
/* make md5 inner */
ret = wc_Md5Copy(&ssl->hsHashes->hashMd5, md5); /* Save current position */
@@ -23969,6 +23972,7 @@ static int BuildSHA_CertVerify(const WOLFSSL* ssl, byte* digest)
#else
wc_Sha sha[1];
#endif
XMEMSET(sha, 0, sizeof(wc_Sha));
/* make sha inner */
ret = wc_ShaCopy(&ssl->hsHashes->hashSha, sha); /* Save current position */
+2
View File
@@ -11982,6 +11982,8 @@ static int ExpectedResumptionSecret(WOLFSSL* ssl)
Digest digest;
static byte header[] = { 0x14, 0x00, 0x00, 0x00 };
XMEMSET(&digest, 0, sizeof(Digest));
/* Copy the running hash so we can restore it after. */
switch (ssl->specs.mac_algorithm) {
#ifndef NO_SHA256
+3
View File
@@ -5846,6 +5846,9 @@ void wolfSSL_EVP_init(void)
if (out->pctx == NULL)
return WOLFSSL_FAILURE;
}
/* Zero hash context after shallow copy to prevent shared sub-pointers
* with src. The hash Copy function will perform the proper deep copy. */
XMEMSET(&out->hash, 0, sizeof(out->hash));
return wolfSSL_EVP_MD_Copy_Hasher(out, (WOLFSSL_EVP_MD_CTX*)in);
}
#ifndef NO_AES