Unverified Commit f92f3714 authored by kokke's avatar kokke Committed by GitHub
Browse files

Update aes.c

parent bdfd794b
...@@ -612,7 +612,7 @@ void AES_CTR_xcrypt_buffer(uint8_t* output, uint8_t* input, uint32_t length, con ...@@ -612,7 +612,7 @@ void AES_CTR_xcrypt_buffer(uint8_t* output, uint8_t* input, uint32_t length, con
int i, j; int i, j;
for (i = 0; i < length; ++i) for (i = 0; i < length; ++i)
{ {
if ((i & 0x0F) == 0) if ((i & (BLOCKLEN - 1)) == 0)
{ {
memcpy(buffer, counter, BLOCKLEN); memcpy(buffer, counter, BLOCKLEN);
state = (state_t*)buffer; state = (state_t*)buffer;
...@@ -629,7 +629,7 @@ void AES_CTR_xcrypt_buffer(uint8_t* output, uint8_t* input, uint32_t length, con ...@@ -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))]);
} }
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment