Fix infinite loop

'ret' could be set to non-zero inside the loop and the 'cmac->bufferSz' never gets reset causing 'add' to become 0 in the subsequent loop.
This commit is contained in:
Andras Fekete
2024-05-08 09:52:37 -04:00
parent d22991bb03
commit 8f9c8a1203

View File

@@ -211,7 +211,7 @@ int wc_CmacUpdate(Cmac* cmac, const byte* in, word32 inSz)
/* Clear CRYPTOCB_UNAVAILABLE return code */
ret = 0;
while (inSz != 0) {
while ((ret == 0) && (inSz != 0)) {
word32 add = min(inSz, AES_BLOCK_SIZE - cmac->bufferSz);
XMEMCPY(&cmac->buffer[cmac->bufferSz], in, add);