Merge pull request #2472 from SparkiDev/enc_then_mac_fix

Enc-Then-MAC: when message size is less than digest size return error
This commit is contained in:
toddouska
2019-09-17 08:57:26 -07:00
committed by GitHub

View File

@@ -13611,6 +13611,10 @@ static WC_INLINE int VerifyMacEnc(WOLFSSL* ssl, const byte* input, word32 msgSz,
WOLFSSL_MSG("Verify MAC of Encrypted Data");
if (msgSz < digestSz) {
return VERIFY_MAC_ERROR;
}
ret = ssl->hmac(ssl, verify, input, msgSz - digestSz, -1, content, 1);
ret |= ConstantCompare(verify, input + msgSz - digestSz, digestSz);
if (ret != 0) {