diff options
author | Egor Tensin <Egor.Tensin@gmail.com> | 2015-06-19 09:42:55 +0300 |
---|---|---|
committer | Egor Tensin <Egor.Tensin@gmail.com> | 2015-06-19 09:42:55 +0300 |
commit | 3716501690fb4e1ddd1af385b4d012cce2d107ac (patch) | |
tree | 1b4f48b22cc980ba7cfb93bd5a83ec5e078157de /include | |
parent | refactoring (diff) | |
download | aes-tools-3716501690fb4e1ddd1af385b4d012cce2d107ac.tar.gz aes-tools-3716501690fb4e1ddd1af385b4d012cce2d107ac.zip |
add buffer encryption to "boxes"
Diffstat (limited to '')
-rw-r--r-- | include/aesni/box.h | 18 | ||||
-rw-r--r-- | include/aesni/box_data.h | 33 | ||||
-rw-r--r-- | include/aesni/error.h | 4 |
3 files changed, 55 insertions, 0 deletions
diff --git a/include/aesni/box.h b/include/aesni/box.h index 3dfbc9e..12daa2e 100644 --- a/include/aesni/box.h +++ b/include/aesni/box.h @@ -11,6 +11,8 @@ #include "box_data.h" #include "error.h" +#include <stdlib.h> + #ifdef __cplusplus extern "C" { @@ -36,6 +38,22 @@ AesNI_StatusCode aesni_box_decrypt_block( AesNI_BoxBlock* plaintext, AesNI_ErrorDetails* err_details); +AesNI_StatusCode aesni_box_encrypt_buffer( + AesNI_Box* box, + const void* src, + size_t src_size, + void* dest, + size_t* dest_size, + AesNI_ErrorDetails* err_details); + +AesNI_StatusCode aesni_box_decrypt_buffer( + AesNI_Box* box, + const void* src, + size_t src_size, + void* dest, + size_t* dest_size, + AesNI_ErrorDetails* err_details); + #ifdef __cplusplus } #endif diff --git a/include/aesni/box_data.h b/include/aesni/box_data.h index 327c9bc..9789f0f 100644 --- a/include/aesni/box_data.h +++ b/include/aesni/box_data.h @@ -97,6 +97,34 @@ typedef AesNI_StatusCode (*AesNI_BoxGetBlockSize)( size_t*, AesNI_ErrorDetails*); +typedef AesNI_StatusCode (*AesNI_BoxStoreBlock)( + void*, + 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; @@ -105,6 +133,11 @@ typedef struct AesNI_BoxXorBlock xor_block; 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; diff --git a/include/aesni/error.h b/include/aesni/error.h index 015b16d..e78406a 100644 --- a/include/aesni/error.h +++ b/include/aesni/error.h @@ -47,6 +47,7 @@ typedef enum AESNI_PARSE_ERROR, ///< Couldn't parse AESNI_INVALID_PKCS7_PADDING_ERROR, ///< Invalid PKCS7 padding while decrypting AESNI_NOT_IMPLEMENTED_ERROR, ///< Not implemented + AESNI_INVALID_PLAINTEXT_LENGTH_ERROR, } AesNI_StatusCode; @@ -167,6 +168,9 @@ AesNI_StatusCode aesni_error_not_implemented( AesNI_ErrorDetails* err_details, const char* what); +AesNI_StatusCode aesni_error_invalid_plaintext_length( + AesNI_ErrorDetails* err_details); + #ifdef __cplusplus } #endif |