Skip to content

Commit 36015e9

Browse files
Merge pull request #6998 from SparkiDev/tls_pad_no_hash_raw_fix
TLS_hmac: when no raw hash, make sure maxSz is not neg
2 parents 9f06d33 + bc36202 commit 36015e9

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

src/tls.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1139,6 +1139,8 @@ static int Hmac_UpdateFinal(Hmac* hmac, byte* digest, const byte* in,
11391139
msgSz &= ~(0 - (msgSz >> 31));
11401140
realSz = WOLFSSL_TLS_HMAC_INNER_SZ + msgSz;
11411141
maxSz = WOLFSSL_TLS_HMAC_INNER_SZ + (sz - 1) - macSz;
1142+
/* Make negative result 0 */
1143+
maxSz &= ~(0 - (maxSz >> 31));
11421144

11431145
/* Calculate #blocks processed in HMAC for max and real data. */
11441146
blocks = maxSz >> blockBits;

0 commit comments

Comments
 (0)