diff options
author | Egor Tensin <Egor.Tensin@gmail.com> | 2015-06-22 01:52:57 +0300 |
---|---|---|
committer | Egor Tensin <Egor.Tensin@gmail.com> | 2015-06-22 01:52:57 +0300 |
commit | 3b705c046c53ee01ba3daed0d0e7468b1a682cbc (patch) | |
tree | 65b5769aaac6b4f950a79cd2690fc30c80923571 /include/aesni/box_data.h | |
parent | bugfix & code style (diff) | |
download | aes-tools-3b705c046c53ee01ba3daed0d0e7468b1a682cbc.tar.gz aes-tools-3b705c046c53ee01ba3daed0d0e7468b1a682cbc.zip |
boxes: a number of improvements
* Algorithm interfaces are no longer required to load partial blocks,
the space for which is allocated dynamically.
* Padding schemes are now also separated, perhaps in the future to
become a "box" parameter.
Consequently, algorithm interfaces are no longer required to implement
padding either.
Diffstat (limited to '')
-rw-r--r-- | include/aesni/box_data.h | 42 |
1 files changed, 2 insertions, 40 deletions
diff --git a/include/aesni/box_data.h b/include/aesni/box_data.h index 9789f0f..8a1e357 100644 --- a/include/aesni/box_data.h +++ b/include/aesni/box_data.h @@ -10,6 +10,7 @@ #include "aes.h" #include "error.h" +#include "mode.h" #include <stdlib.h> @@ -26,24 +27,6 @@ typedef union } AesNI_BoxAlgorithmParams; -typedef enum -{ - AESNI_AES128, - AESNI_AES192, - AESNI_AES256, -} -AesNI_BoxAlgorithm; - -typedef enum -{ - AESNI_ECB, - AESNI_CBC, - AESNI_CFB, - AESNI_OFB, - AESNI_CTR, -} -AesNI_BoxMode; - typedef union { AesNI_Aes128_RoundKeys aes128_encryption_keys; @@ -102,29 +85,11 @@ typedef AesNI_StatusCode (*AesNI_BoxStoreBlock)( const AesNI_BoxBlock*, AesNI_ErrorDetails*); -typedef AesNI_StatusCode (*AesNI_BoxStorePartialBlock)( - void*, - const AesNI_BoxBlock*, - size_t, - AesNI_ErrorDetails*); - typedef AesNI_StatusCode (*AesNI_BoxLoadBlock)( AesNI_BoxBlock*, const void*, AesNI_ErrorDetails*); -typedef AesNI_StatusCode (*AesNI_BoxLoadPartialBlock)( - AesNI_BoxBlock*, - const void*, - size_t, - AesNI_ErrorDetails*); - -typedef AesNI_StatusCode (*AesNI_BoxLoadBlockWithPadding)( - AesNI_BoxBlock*, - const void*, - size_t, - AesNI_ErrorDetails*); - typedef struct { AesNI_BoxDeriveParams derive_params; @@ -134,10 +99,7 @@ typedef struct AesNI_BoxNextCounter next_counter; AesNI_BoxGetBlockSize get_block_size; AesNI_BoxStoreBlock store_block; - AesNI_BoxStorePartialBlock store_partial_block; AesNI_BoxLoadBlock load_block; - AesNI_BoxLoadPartialBlock load_partial_block; - AesNI_BoxLoadBlockWithPadding load_block_with_padding; } AesNI_BoxAlgorithmInterface; @@ -146,7 +108,7 @@ typedef struct const AesNI_BoxAlgorithmInterface* algorithm; AesNI_BoxEncryptionParams encrypt_params; AesNI_BoxDecryptionParams decrypt_params; - AesNI_BoxMode mode; + AesNI_Mode mode; AesNI_BoxBlock iv; } AesNI_Box; |