mirror of https://github.com/wolfSSL/wolfssh.git
Fix mac comparison in VerifyMac
parent
dc914afd73
commit
a2d4973060
|
|
@ -10448,7 +10448,7 @@ static INLINE int VerifyMac(WOLFSSH* ssh, const byte* in, word32 inSz,
|
|||
ret = wc_HmacUpdate(&hmac, in, inSz);
|
||||
if (ret == WS_SUCCESS)
|
||||
ret = wc_HmacFinal(&hmac, checkMac);
|
||||
if (ConstantCompare(checkMac, mac, ssh->peerMacSz) != 0)
|
||||
if (ret == WS_SUCCESS && ConstantCompare(checkMac, mac, ssh->peerMacSz) != 0)
|
||||
ret = WS_VERIFY_MAC_E;
|
||||
break;
|
||||
|
||||
|
|
@ -10461,7 +10461,7 @@ static INLINE int VerifyMac(WOLFSSH* ssh, const byte* in, word32 inSz,
|
|||
ret = wc_HmacUpdate(&hmac, in, inSz);
|
||||
if (ret == WS_SUCCESS)
|
||||
ret = wc_HmacFinal(&hmac, checkMac);
|
||||
if (ConstantCompare(checkMac, mac, ssh->peerMacSz) != 0)
|
||||
if (ret == WS_SUCCESS && ConstantCompare(checkMac, mac, ssh->peerMacSz) != 0)
|
||||
ret = WS_VERIFY_MAC_E;
|
||||
break;
|
||||
|
||||
|
|
@ -10474,7 +10474,7 @@ static INLINE int VerifyMac(WOLFSSH* ssh, const byte* in, word32 inSz,
|
|||
ret = wc_HmacUpdate(&hmac, in, inSz);
|
||||
if (ret == WS_SUCCESS)
|
||||
ret = wc_HmacFinal(&hmac, checkMac);
|
||||
if (ConstantCompare(checkMac, mac, ssh->peerMacSz) != 0)
|
||||
if (ret == WS_SUCCESS && ConstantCompare(checkMac, mac, ssh->peerMacSz) != 0)
|
||||
ret = WS_VERIFY_MAC_E;
|
||||
break;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue