init buffer before creating digest value

This commit is contained in:
JacobBarthelmeh
2025-04-22 14:34:16 -06:00
parent e6f8de7d31
commit 43cdc1be74

View File

@ -21574,6 +21574,7 @@ static WC_INLINE int VerifyMacEnc(WOLFSSL* ssl, const byte* input, word32 msgSz,
WOLFSSL_ERROR_VERBOSE(VERIFY_MAC_ERROR); WOLFSSL_ERROR_VERBOSE(VERIFY_MAC_ERROR);
return VERIFY_MAC_ERROR; return VERIFY_MAC_ERROR;
} }
XMEMSET(verify, 0, WC_MAX_DIGEST_SIZE);
ret = ssl->hmac(ssl, verify, input, msgSz - digestSz, -1, content, 1, PEER_ORDER); ret = ssl->hmac(ssl, verify, input, msgSz - digestSz, -1, content, 1, PEER_ORDER);
ret |= ConstantCompare(verify, input + msgSz - digestSz, (int)digestSz); ret |= ConstantCompare(verify, input + msgSz - digestSz, (int)digestSz);
@ -21596,7 +21597,7 @@ static WC_INLINE int VerifyMac(WOLFSSL* ssl, const byte* input, word32 msgSz,
word32 digestSz = MacSize(ssl); word32 digestSz = MacSize(ssl);
byte verify[WC_MAX_DIGEST_SIZE]; byte verify[WC_MAX_DIGEST_SIZE];
XMEMSET(verify, 0, WC_MAX_DIGEST_SIZE);
if (ssl->specs.cipher_type == block) { if (ssl->specs.cipher_type == block) {
pad = input[msgSz - 1]; pad = input[msgSz - 1];
padByte = 1; padByte = 1;