diff options
author | Egor Tensin <Egor.Tensin@gmail.com> | 2015-10-20 03:11:50 +0300 |
---|---|---|
committer | Egor Tensin <Egor.Tensin@gmail.com> | 2015-10-20 03:11:50 +0300 |
commit | f9665896e3deb6c449c764ba8b30f700abe36cd5 (patch) | |
tree | 4203b64ccf2fb8ad4d40f20edad8aeff9448ab63 /include/aesni | |
parent | add missing `assert`s (diff) | |
download | aes-tools-f9665896e3deb6c449c764ba8b30f700abe36cd5.tar.gz aes-tools-f9665896e3deb6c449c764ba8b30f700abe36cd5.zip |
cxx: implement "boxes"
Diffstat (limited to 'include/aesni')
-rw-r--r-- | include/aesni/box.h | 24 | ||||
-rw-r--r-- | include/aesni/box_data.h | 39 |
2 files changed, 59 insertions, 4 deletions
diff --git a/include/aesni/box.h b/include/aesni/box.h index 04c2b6c..58517e1 100644 --- a/include/aesni/box.h +++ b/include/aesni/box.h @@ -27,6 +27,30 @@ AesNI_StatusCode aesni_box_init( const AesNI_BoxBlock* iv, AesNI_ErrorDetails* err_details); +AesNI_StatusCode aesni_box_parse_key( + AesNI_BoxKey* dest, + AesNI_Algorithm algorithm, + const char* src, + AesNI_ErrorDetails* err_details); + +AesNI_StatusCode aesni_box_parse_block( + AesNI_BoxBlock* dest, + AesNI_Algorithm algorithm, + const char* src, + AesNI_ErrorDetails* err_details); + +AesNI_StatusCode aesni_box_format_key( + AesNI_BoxKeyString* dest, + AesNI_Algorithm algorithm, + const AesNI_BoxKey* src, + AesNI_ErrorDetails* err_details); + +AesNI_StatusCode aesni_box_format_block( + AesNI_BoxBlockString* dest, + AesNI_Algorithm algorithm, + const AesNI_BoxBlock* src, + AesNI_ErrorDetails* err_details); + AesNI_StatusCode aesni_box_encrypt_block( AesNI_Box* box, const AesNI_BoxBlock* plaintext, diff --git a/include/aesni/box_data.h b/include/aesni/box_data.h index d184c30..888c7c0 100644 --- a/include/aesni/box_data.h +++ b/include/aesni/box_data.h @@ -45,20 +45,49 @@ AesNI_BoxDecryptionRoundKeys; typedef union { + AesNI_AES128_KeyString aes128; + AesNI_AES192_KeyString aes192; + AesNI_AES256_KeyString aes256; +} +AesNI_BoxKeyString; + +typedef union +{ AesNI_AES_Block aes_block; } AesNI_BoxBlock; +typedef union +{ + AesNI_AES_BlockString aes; +} +AesNI_BoxBlockString; + typedef AesNI_StatusCode (*AesNI_BoxCalculateRoundKeys)( const AesNI_BoxKey* params, AesNI_BoxEncryptionRoundKeys*, AesNI_BoxDecryptionRoundKeys*, AesNI_ErrorDetails* err_details); -/* typedef AesNI_StatusCode (*AesNI_BoxParseBlock)( +typedef AesNI_StatusCode (*AesNI_BoxParseBlock)( AesNI_BoxBlock* dest, const char* src, - AesNI_ErrorDetails* err_details); */ + AesNI_ErrorDetails* err_details); + +typedef AesNI_StatusCode (*AesNI_BoxParseKey)( + AesNI_BoxKey* dest, + const char* src, + AesNI_ErrorDetails* err_details); + +typedef AesNI_StatusCode (*AesNI_BoxFormatBlock)( + AesNI_BoxBlockString* dest, + const AesNI_BoxBlock* src, + AesNI_ErrorDetails* err_details); + +typedef AesNI_StatusCode (*AesNI_BoxFormatKey)( + AesNI_BoxKeyString* dest, + const AesNI_BoxKey* src, + AesNI_ErrorDetails* err_details); typedef AesNI_StatusCode (*AesNI_BoxEncryptBlock)( const AesNI_BoxBlock* plaintext, @@ -98,8 +127,10 @@ typedef AesNI_StatusCode (*AesNI_BoxLoadBlock)( typedef struct { AesNI_BoxCalculateRoundKeys calc_round_keys; - //AesNI_BoxParseBlock parse_block; - //AesNI_BoxParseKey parse_key; + AesNI_BoxParseBlock parse_block; + AesNI_BoxParseKey parse_key; + AesNI_BoxFormatBlock format_block; + AesNI_BoxFormatKey format_key; AesNI_BoxEncryptBlock encrypt_block; AesNI_BoxDecryptBlock decrypt_block; AesNI_BoxXorBlock xor_block; |