memset 0 the temp contexts

This commit is contained in:
night1rider
2026-02-24 16:20:28 -07:00
parent 4c9b980c72
commit 60573a3782
3 changed files with 9 additions and 0 deletions
+4
View File
@@ -12368,6 +12368,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);
@@ -12413,6 +12414,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)
@@ -23919,6 +23921,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 */
@@ -23962,6 +23965,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
@@ -11983,6 +11983,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