From 9acae40f3ec8dc728a14e298a4ad9505a1d4a3bd Mon Sep 17 00:00:00 2001 From: kokke Date: Fri, 1 Dec 2017 01:48:19 +0100 Subject: Update aes.c --- aes.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/aes.c b/aes.c index a797480..3cf09ba 100644 --- a/aes.c +++ b/aes.c @@ -618,10 +618,12 @@ void AES_CTR_xcrypt_buffer(uint8_t* output, uint8_t* input, uint32_t length, con state = (state_t*)buffer; Cipher(); + /* Increment counter and handle overflow */ for (j = (BLOCKLEN - 1); j >= 0; --j) { counter[j] += 1; + /* Break if no overflow, keep going otherwise */ if (counter[j] != 0) { break; -- cgit v1.2.3