summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkokke <spam@rowdy.dk>2017-12-01 01:39:34 +0100
committerGitHub <noreply@github.com>2017-12-01 01:39:34 +0100
commitbfd5cc90bcd3221ec17e5e8675ff771ffb54168e (patch)
treed7e4a3151c0fff7d885b480e5cea5fbd93245aae
parentUpdate aes.h (diff)
downloadtiny-AES-c-bfd5cc90bcd3221ec17e5e8675ff771ffb54168e.tar
tiny-AES-c-bfd5cc90bcd3221ec17e5e8675ff771ffb54168e.tar.gz
tiny-AES-c-bfd5cc90bcd3221ec17e5e8675ff771ffb54168e.tar.bz2
tiny-AES-c-bfd5cc90bcd3221ec17e5e8675ff771ffb54168e.tar.lz
tiny-AES-c-bfd5cc90bcd3221ec17e5e8675ff771ffb54168e.tar.xz
tiny-AES-c-bfd5cc90bcd3221ec17e5e8675ff771ffb54168e.tar.zst
tiny-AES-c-bfd5cc90bcd3221ec17e5e8675ff771ffb54168e.zip
-rw-r--r--aes.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/aes.c b/aes.c
index 32f3552..c15895e 100644
--- a/aes.c
+++ b/aes.c
@@ -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();