Merge pull request #5757 from SparkiDev/enc_err_forcezero_fix

ForceZero fix: encryption fail and not EtM
This commit is contained in:
JacobBarthelmeh
2022-10-31 11:43:48 -06:00
committed by GitHub

View File

@ -20813,9 +20813,17 @@ int BuildMessage(WOLFSSL* ssl, byte* output, int outSz, const byte* input,
#endif
{
/* Zeroize plaintext. */
#if defined(HAVE_ENCRYPT_THEN_MAC) && !defined(WOLFSSL_AEAD_ONLY)
if (ssl->options.startedETMWrite) {
ForceZero(output + args->headerSz,
(word16)(args->size - args->digestSz));
}
else
#endif
{
ForceZero(output + args->headerSz, (word16)args->size);
}
}
goto exit_buildmsg;
}
ssl->options.buildMsgState = BUILD_MSG_ENCRYPTED_VERIFY_MAC;