From b08c0e5b32c625215bee0ae96a023733d34e9357 Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Sat, 30 May 2015 00:38:19 +0300 Subject: support AES-{128,192}-cbc --- include/aesni/api.h | 32 ++++++++++++++++++++++++++++++++ include/aesni/raw.h | 20 ++++++++++++++++++++ 2 files changed, 52 insertions(+) (limited to 'include/aesni') diff --git a/include/aesni/api.h b/include/aesni/api.h index 64d169c..d64b225 100644 --- a/include/aesni/api.h +++ b/include/aesni/api.h @@ -25,6 +25,22 @@ static __inline AesBlock128 __fastcall aes128ecb_decrypt( return raw_aes128ecb_decrypt(cypher, key); } +static __inline AesBlock128 __fastcall aes128cbc_encrypt( + AesBlock128 plain, + AesBlock128 key, + AesBlock128* initialization_vector) +{ + return raw_aes128cbc_encrypt(plain, key, initialization_vector); +} + +static __inline AesBlock128 __fastcall aes128cbc_decrypt( + AesBlock128 cypher, + AesBlock128 key, + AesBlock128* initialization_vector) +{ + return raw_aes128cbc_decrypt(cypher, key, initialization_vector); +} + static __inline AesBlock128 __fastcall aes192ecb_encrypt( AesBlock128 plain, AesBlock192* key) @@ -39,6 +55,22 @@ static __inline AesBlock128 __fastcall aes192ecb_decrypt( return raw_aes192ecb_decrypt(cypher, key->lo, key->hi); } +static __inline AesBlock128 __fastcall aes192cbc_encrypt( + AesBlock128 plain, + AesBlock192* key, + AesBlock128* initialization_vector) +{ + return raw_aes192cbc_encrypt(plain, key->lo, key->hi, initialization_vector); +} + +static __inline AesBlock128 __fastcall aes192cbc_decrypt( + AesBlock128 cypher, + AesBlock192* key, + AesBlock128* initialization_vector) +{ + return raw_aes192cbc_decrypt(cypher, key->lo, key->hi, initialization_vector); +} + static __inline AesBlock128 __fastcall aes256ecb_encrypt( AesBlock128 plain, AesBlock256* key) diff --git a/include/aesni/raw.h b/include/aesni/raw.h index d648cac..ffda8d2 100644 --- a/include/aesni/raw.h +++ b/include/aesni/raw.h @@ -17,6 +17,15 @@ AesBlock128 __fastcall raw_aes128ecb_decrypt( AesBlock128 cypher, AesBlock128 key); +AesBlock128 __fastcall raw_aes128cbc_encrypt( + AesBlock128 plain, + AesBlock128 key, + AesBlock128* iv); +AesBlock128 __fastcall raw_aes128cbc_decrypt( + AesBlock128 cypher, + AesBlock128 key, + AesBlock128* iv); + AesBlock128 __fastcall raw_aes192ecb_encrypt( AesBlock128 plain, AesBlock128 key_lo, @@ -26,6 +35,17 @@ AesBlock128 __fastcall raw_aes192ecb_decrypt( AesBlock128 key_lo, AesBlock128 key_hi); +AesBlock128 __fastcall raw_aes192cbc_encrypt( + AesBlock128 plain, + AesBlock128 key_lo, + AesBlock128 key_hi, + AesBlock128 *iv); +AesBlock128 __fastcall raw_aes192cbc_decrypt( + AesBlock128 cypher, + AesBlock128 key_lo, + AesBlock128 key_hi, + AesBlock128 *iv); + AesBlock128 __fastcall raw_aes256ecb_encrypt( AesBlock128 plain, AesBlock128 key_lo, -- cgit v1.2.3