summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--aes.c2
1 files changed, 2 insertions, 0 deletions
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;