Update aes.c

This commit is contained in:
kokke 2017-12-01 01:39:34 +01:00 committed by GitHub
parent 1e9105ae24
commit bfd5cc90bc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 2 deletions

5
aes.c
View File

@ -600,11 +600,12 @@ void AES_CBC_decrypt_buffer(uint8_t* output, uint8_t* input, uint32_t length, co
#if defined(CTR) && (CTR == 1)
void AES_CTR_xcrypt_buffer(uint8_t* output, uint8_t* input, uint32_t length, const uint8_t* key, const uint8_t* iv)
/* Symmetrical operation: same function for encrypting as for decrypting. Note any IV/nonce should never be reused with the same key */
void AES_CTR_xcrypt_buffer(uint8_t* output, uint8_t* input, uint32_t length, const uint8_t* key, const uint8_t* nonce)
{
uint8_t buffer[BLOCKLEN], counter[BLOCKLEN];
memcpy(counter, iv, BLOCKLEN);
memcpy(counter, nonce, BLOCKLEN);
Key = key;
KeyExpansion();