mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2025-08-02 04:04:39 +02:00
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:
@@ -13611,6 +13611,10 @@ static WC_INLINE int VerifyMacEnc(WOLFSSL* ssl, const byte* input, word32 msgSz,
|
|||||||
|
|
||||||
WOLFSSL_MSG("Verify MAC of Encrypted Data");
|
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 = ssl->hmac(ssl, verify, input, msgSz - digestSz, -1, content, 1);
|
||||||
ret |= ConstantCompare(verify, input + msgSz - digestSz, digestSz);
|
ret |= ConstantCompare(verify, input + msgSz - digestSz, digestSz);
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
|
Reference in New Issue
Block a user