aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2015-06-24 01:26:37 +0300
committerEgor Tensin <Egor.Tensin@gmail.com>2015-06-24 01:26:37 +0300
commit46d9e1918a3d9dd1eb2983159ef132933bce9e19 (patch)
tree8c9abe55abf49b555201f09512772b9853e6551d
parentuse macros to get rid of repetitive code (diff)
downloadaes-tools-46d9e1918a3d9dd1eb2983159ef132933bce9e19.tar.gz
aes-tools-46d9e1918a3d9dd1eb2983159ef132933bce9e19.zip
refactoring
-rw-r--r--cxx/include/aesnixx/data.hpp4
-rw-r--r--include/aesni/box_data.h4
-rw-r--r--src/box.c2
-rw-r--r--src/box_aes.c10
4 files changed, 10 insertions, 10 deletions
diff --git a/cxx/include/aesnixx/data.hpp b/cxx/include/aesnixx/data.hpp
index 98b5c98..1a93b7c 100644
--- a/cxx/include/aesnixx/data.hpp
+++ b/cxx/include/aesnixx/data.hpp
@@ -41,7 +41,7 @@ namespace aesni
aesni_store_block128_aligned(dest, src);
}
- inline Block128 xor_block(Block128& a, Block128& b)
+ inline Block128 xor_blocks(Block128& a, Block128& b)
{
return aesni_xor_block128(a, b);
}
@@ -51,7 +51,7 @@ namespace aesni
return aesni_reverse_byte_order_block128(block);
}
- inline Block128 inc(Block128& block)
+ inline Block128 inc_block(Block128& block)
{
return aesni_inc_block128(block);
}
diff --git a/include/aesni/box_data.h b/include/aesni/box_data.h
index 8a1e357..ff36885 100644
--- a/include/aesni/box_data.h
+++ b/include/aesni/box_data.h
@@ -72,7 +72,7 @@ typedef AesNI_StatusCode (*AesNI_BoxXorBlock)(
const AesNI_BoxBlock*,
AesNI_ErrorDetails*);
-typedef AesNI_StatusCode (*AesNI_BoxNextCounter)(
+typedef AesNI_StatusCode (*AesNI_BoxIncBlock)(
AesNI_BoxBlock*,
AesNI_ErrorDetails*);
@@ -96,7 +96,7 @@ typedef struct
AesNI_BoxEncryptBlock encrypt_block;
AesNI_BoxDecryptBlock decrypt_block;
AesNI_BoxXorBlock xor_block;
- AesNI_BoxNextCounter next_counter;
+ AesNI_BoxIncBlock inc_block;
AesNI_BoxGetBlockSize get_block_size;
AesNI_BoxStoreBlock store_block;
AesNI_BoxLoadBlock load_block;
diff --git a/src/box.c b/src/box.c
index d67eeb7..7fa59d1 100644
--- a/src/box.c
+++ b/src/box.c
@@ -131,7 +131,7 @@ static AesNI_StatusCode aesni_box_encrypt_block_ctr(
output, input, err_details)))
return status;
- if (aesni_is_error(status = box->algorithm->next_counter(
+ if (aesni_is_error(status = box->algorithm->inc_block(
&box->iv, err_details)))
return status;
diff --git a/src/box_aes.c b/src/box_aes.c
index 7826ca2..4e32aea 100644
--- a/src/box_aes.c
+++ b/src/box_aes.c
@@ -63,11 +63,11 @@ static AesNI_StatusCode aesni_box_xor_block_aes(
const AesNI_BoxBlock* src,
AesNI_ErrorDetails* err_details)
{
- dest->aes_block = aesni_xor_block128(dest->aes_block, src->aes_block);
+ dest->aes_block = aesni_aes_xor_blocks(dest->aes_block, src->aes_block);
return AESNI_SUCCESS;
}
-static AesNI_StatusCode aesni_box_next_counter_aes(
+static AesNI_StatusCode aesni_box_inc_block_aes(
AesNI_BoxBlock* ctr,
AesNI_ErrorDetails* err_details)
{
@@ -179,7 +179,7 @@ AesNI_BoxAlgorithmInterface aesni_box_algorithm_aes128 =
&aesni_box_encrypt_block_aes128,
&aesni_box_decrypt_block_aes128,
&aesni_box_xor_block_aes,
- &aesni_box_next_counter_aes,
+ &aesni_box_inc_block_aes,
&aesni_box_get_block_size_aes,
&aesni_box_store_block_aes,
&aesni_box_load_block_aes,
@@ -191,7 +191,7 @@ AesNI_BoxAlgorithmInterface aesni_box_algorithm_aes192 =
&aesni_box_encrypt_block_aes192,
&aesni_box_decrypt_block_aes192,
&aesni_box_xor_block_aes,
- &aesni_box_next_counter_aes,
+ &aesni_box_inc_block_aes,
&aesni_box_get_block_size_aes,
&aesni_box_store_block_aes,
&aesni_box_load_block_aes,
@@ -203,7 +203,7 @@ AesNI_BoxAlgorithmInterface aesni_box_algorithm_aes256 =
&aesni_box_encrypt_block_aes256,
&aesni_box_decrypt_block_aes256,
&aesni_box_xor_block_aes,
- &aesni_box_next_counter_aes,
+ &aesni_box_inc_block_aes,
&aesni_box_get_block_size_aes,
&aesni_box_store_block_aes,
&aesni_box_load_block_aes,