@@ -4867,6 +4867,10 @@ static int EchCheckAcceptance(WOLFSSL* ssl, byte* label, word16 labelSz,
48674867 XMEMSET(transcriptEchConf, 0, sizeof(transcriptEchConf));
48684868 XMEMSET(expandLabelPrk, 0, sizeof(expandLabelPrk));
48694869 XMEMSET(acceptConfirmation, 0, sizeof(acceptConfirmation));
4870+ #ifdef WOLFSSL_CHECK_MEM_ZERO
4871+ wc_MemZero_Add("ECH PRK", expandLabelPrk,
4872+ sizeof(expandLabelPrk));
4873+ #endif
48704874 /* store so we can restore regardless of the outcome */
48714875 tmpHashes = ssl->hsHashes;
48724876 /* swap hsHashes to hsHashesEch */
@@ -4975,6 +4979,10 @@ static int EchCheckAcceptance(WOLFSSL* ssl, byte* label, word16 labelSz,
49754979 ssl->hsHashesEch = NULL;
49764980 /* swap to tmp, will be inner if accepted, hsHashes if rejected */
49774981 ssl->hsHashes = tmpHashes;
4982+ ForceZero(expandLabelPrk, sizeof(expandLabelPrk));
4983+ #ifdef WOLFSSL_CHECK_MEM_ZERO
4984+ wc_MemZero_Check(expandLabelPrk, sizeof(expandLabelPrk));
4985+ #endif
49784986 return ret;
49794987}
49804988#endif
@@ -7336,6 +7344,10 @@ static int EchWriteAcceptance(WOLFSSL* ssl, byte* label, word16 labelSz,
73367344 XMEMSET(zeros, 0, sizeof(zeros));
73377345 XMEMSET(transcriptEchConf, 0, sizeof(transcriptEchConf));
73387346 XMEMSET(expandLabelPrk, 0, sizeof(expandLabelPrk));
7347+ #ifdef WOLFSSL_CHECK_MEM_ZERO
7348+ wc_MemZero_Add("ECH PRK", expandLabelPrk,
7349+ sizeof(expandLabelPrk));
7350+ #endif
73397351 /* store so we can restore regardless of the outcome */
73407352 tmpHashes = ssl->hsHashes;
73417353 ssl->hsHashes = ssl->hsHashesEch;
@@ -7417,6 +7429,10 @@ static int EchWriteAcceptance(WOLFSSL* ssl, byte* label, word16 labelSz,
74177429 FreeHandshakeHashes(ssl);
74187430 ssl->hsHashesEch = NULL;
74197431 ssl->hsHashes = tmpHashes;
7432+ ForceZero(expandLabelPrk, sizeof(expandLabelPrk));
7433+ #ifdef WOLFSSL_CHECK_MEM_ZERO
7434+ wc_MemZero_Check(expandLabelPrk, sizeof(expandLabelPrk));
7435+ #endif
74207436 return ret;
74217437}
74227438#endif
0 commit comments