From f92f3714388069be123f34ce2f201fb986687006 Mon Sep 17 00:00:00 2001 From: kokke Date: Fri, 1 Dec 2017 01:44:23 +0100 Subject: [PATCH] Update aes.c --- aes.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/aes.c b/aes.c index c15895e..a797480 100644 --- a/aes.c +++ b/aes.c @@ -612,7 +612,7 @@ void AES_CTR_xcrypt_buffer(uint8_t* output, uint8_t* input, uint32_t length, con int i, j; for (i = 0; i < length; ++i) { - if ((i & 0x0F) == 0) + if ((i & (BLOCKLEN - 1)) == 0) { memcpy(buffer, counter, BLOCKLEN); state = (state_t*)buffer; @@ -629,7 +629,7 @@ void AES_CTR_xcrypt_buffer(uint8_t* output, uint8_t* input, uint32_t length, con } } - output[i] = (input[i] ^ buffer[(i & 0x0F)]); + output[i] = (input[i] ^ buffer[(i & (BLOCKLEN - 1))]); } }