aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/buffer.c
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2015-06-17 21:09:42 +0300
committerEgor Tensin <Egor.Tensin@gmail.com>2015-06-17 21:09:42 +0300
commit8430473494fcdbf39e02fcff80d51124df728e97 (patch)
treeba2a30c419e2d2e9fdd05ff697d98e24f1ef1876 /src/buffer.c
parentfactoring out AES-specific stuff (diff)
downloadaes-tools-8430473494fcdbf39e02fcff80d51124df728e97.tar.gz
aes-tools-8430473494fcdbf39e02fcff80d51124df728e97.zip
refactoring
Diffstat (limited to 'src/buffer.c')
-rw-r--r--src/buffer.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/buffer.c b/src/buffer.c
index 983c5cf..80120db 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -18,7 +18,7 @@ AesNI_StatusCode aesni_encrypt_buffer_ecb128(
size_t src_size,
void* dest,
size_t* dest_size,
- AesNI_Aes128_RoundKeys* key_schedule,
+ AesNI_Aes128_RoundKeys* encryption_keys,
AesNI_ErrorDetails* err_details)
{
if (dest_size == NULL)
@@ -32,15 +32,15 @@ AesNI_StatusCode aesni_encrypt_buffer_ecb128(
return AESNI_SUCCESS;
if (src == NULL)
return aesni_make_null_argument_error(err_details, "src");
- if (key_schedule == NULL)
- return aesni_make_null_argument_error(err_details, "key_schedule");
+ if (encryption_keys == NULL)
+ return aesni_make_null_argument_error(err_details, "encryption_keys");
const size_t src_len = src_size / 16;
for (size_t i = 0; i < src_len; ++i, (char*) src += 16, (char*) dest += 16)
{
AesNI_Block128 plaintext = aesni_load_block128(src);
- AesNI_Block128 ciphertext = aesni_aes128_encrypt_block_ecb(plaintext, key_schedule);
+ AesNI_Block128 ciphertext = aesni_aes128_encrypt_block_ecb(plaintext, encryption_keys);
aesni_store_block128(dest, ciphertext);
}
@@ -57,7 +57,7 @@ AesNI_StatusCode aesni_encrypt_buffer_ecb128(
}
AesNI_Block128 plaintext = aesni_load_block128(padding);
- AesNI_Block128 ciphertext = aesni_aes128_encrypt_block_ecb(plaintext, key_schedule);
+ AesNI_Block128 ciphertext = aesni_aes128_encrypt_block_ecb(plaintext, encryption_keys);
aesni_store_block128(dest, ciphertext);
return AESNI_SUCCESS;
@@ -80,7 +80,7 @@ AesNI_StatusCode aesni_decrypt_buffer_ecb128(
size_t src_size,
void* dest,
size_t* dest_size,
- AesNI_Aes128_RoundKeys* inverted_schedule,
+ AesNI_Aes128_RoundKeys* decryption_keys,
AesNI_ErrorDetails* err_details)
{
if (dest_size == NULL)
@@ -92,20 +92,20 @@ AesNI_StatusCode aesni_decrypt_buffer_ecb128(
return 0;
if (src == NULL)
return aesni_make_null_argument_error(err_details, "src");
- if (inverted_schedule == NULL)
- return aesni_make_null_argument_error(err_details, "inverted_schedule");
+ if (decryption_keys == NULL)
+ return aesni_make_null_argument_error(err_details, "decryption_keys");
const size_t src_len = src_size / 16;
for (size_t i = 0; i < src_len - 1; ++i, (char*) src += 16, (char*) dest += 16)
{
AesNI_Block128 ciphertext = aesni_load_block128(src);
- AesNI_Block128 plaintext = aesni_aes128_decrypt_block_ecb(ciphertext, inverted_schedule);
+ AesNI_Block128 plaintext = aesni_aes128_decrypt_block_ecb(ciphertext, decryption_keys);
aesni_store_block128(dest, plaintext);
}
AesNI_Block128 ciphertext = aesni_load_block128(src);
- AesNI_Block128 plaintext = aesni_aes128_decrypt_block_ecb(ciphertext, inverted_schedule);
+ AesNI_Block128 plaintext = aesni_aes128_decrypt_block_ecb(ciphertext, decryption_keys);
unsigned char padding[16];
aesni_store_block128(padding, plaintext);