diff options
author | Egor Tensin <Egor.Tensin@gmail.com> | 2015-06-19 05:36:34 +0300 |
---|---|---|
committer | Egor Tensin <Egor.Tensin@gmail.com> | 2015-06-19 05:36:34 +0300 |
commit | a386820259790f08073bc84bb868c9907558bb84 (patch) | |
tree | bc46ca07ef0d0a3671f8d0ecc1a45295881ec289 /include | |
parent | error message update (diff) | |
download | aes-tools-a386820259790f08073bc84bb868c9907558bb84.tar.gz aes-tools-a386820259790f08073bc84bb868c9907558bb84.zip |
refactoring
Diffstat (limited to '')
-rw-r--r-- | include/aesni/box.h | 4 | ||||
-rw-r--r-- | include/aesni/box_aes.h | 6 | ||||
-rw-r--r-- | include/aesni/box_data.h | 21 |
3 files changed, 19 insertions, 12 deletions
diff --git a/include/aesni/box.h b/include/aesni/box.h index bc270ee..3dfbc9e 100644 --- a/include/aesni/box.h +++ b/include/aesni/box.h @@ -24,13 +24,13 @@ AesNI_StatusCode aesni_box_init( const AesNI_BoxBlock* iv, AesNI_ErrorDetails* err_details); -AesNI_StatusCode aesni_box_encrypt( +AesNI_StatusCode aesni_box_encrypt_block( AesNI_Box* box, const AesNI_BoxBlock* plaintext, AesNI_BoxBlock* ciphertext, AesNI_ErrorDetails* err_details); -AesNI_StatusCode aesni_box_decrypt( +AesNI_StatusCode aesni_box_decrypt_block( AesNI_Box* box, const AesNI_BoxBlock* ciphertext, AesNI_BoxBlock* plaintext, diff --git a/include/aesni/box_aes.h b/include/aesni/box_aes.h index 62259a2..3d7faec 100644 --- a/include/aesni/box_aes.h +++ b/include/aesni/box_aes.h @@ -15,9 +15,9 @@ extern "C" { #endif -extern AesNI_BoxAlgorithmInterface aesni_box_aes128_iface; -extern AesNI_BoxAlgorithmInterface aesni_box_aes192_iface; -extern AesNI_BoxAlgorithmInterface aesni_box_aes256_iface; +extern AesNI_BoxAlgorithmInterface aesni_box_algorithm_aes128; +extern AesNI_BoxAlgorithmInterface aesni_box_algorithm_aes192; +extern AesNI_BoxAlgorithmInterface aesni_box_algorithm_aes256; #ifdef __cplusplus } diff --git a/include/aesni/box_data.h b/include/aesni/box_data.h index ecd98a9..327c9bc 100644 --- a/include/aesni/box_data.h +++ b/include/aesni/box_data.h @@ -11,6 +11,8 @@ #include "aes.h" #include "error.h" +#include <stdlib.h> + #ifdef __cplusplus extern "C" { @@ -70,13 +72,13 @@ typedef AesNI_StatusCode (*AesNI_BoxDeriveParams)( AesNI_BoxDecryptionParams*, AesNI_ErrorDetails* err_details); -typedef AesNI_StatusCode (*AesNI_BoxEncrypt)( +typedef AesNI_StatusCode (*AesNI_BoxEncryptBlock)( const AesNI_BoxBlock* plaintext, const AesNI_BoxEncryptionParams* params, AesNI_BoxBlock* ciphertext, AesNI_ErrorDetails* err_details); -typedef AesNI_StatusCode (*AesNI_BoxDecrypt)( +typedef AesNI_StatusCode (*AesNI_BoxDecryptBlock)( const AesNI_BoxBlock* ciphertext, const AesNI_BoxDecryptionParams* params, AesNI_BoxBlock* plaintext, @@ -87,23 +89,28 @@ typedef AesNI_StatusCode (*AesNI_BoxXorBlock)( const AesNI_BoxBlock*, AesNI_ErrorDetails*); -typedef AesNI_StatusCode (*AesNI_BoxIncCounter)( +typedef AesNI_StatusCode (*AesNI_BoxNextCounter)( AesNI_BoxBlock*, AesNI_ErrorDetails*); +typedef AesNI_StatusCode (*AesNI_BoxGetBlockSize)( + size_t*, + AesNI_ErrorDetails*); + typedef struct { AesNI_BoxDeriveParams derive_params; - AesNI_BoxEncrypt encrypt; - AesNI_BoxDecrypt decrypt; + AesNI_BoxEncryptBlock encrypt_block; + AesNI_BoxDecryptBlock decrypt_block; AesNI_BoxXorBlock xor_block; - AesNI_BoxIncCounter inc_counter; + AesNI_BoxNextCounter next_counter; + AesNI_BoxGetBlockSize get_block_size; } AesNI_BoxAlgorithmInterface; typedef struct { - const AesNI_BoxAlgorithmInterface* algorithm_iface; + const AesNI_BoxAlgorithmInterface* algorithm; AesNI_BoxEncryptionParams encrypt_params; AesNI_BoxDecryptionParams decrypt_params; AesNI_BoxMode mode; |