aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/include/aesni
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2015-06-03 21:32:49 +0300
committerEgor Tensin <Egor.Tensin@gmail.com>2015-06-03 21:32:49 +0300
commit1dd052e86fa45a215b68152977e0c7888eba9bf4 (patch)
tree3f1f65fe4daaf8a2d87791319579c4fb2fdbcf42 /include/aesni
parentimplement CBC wrappers in C (diff)
downloadaes-tools-1dd052e86fa45a215b68152977e0c7888eba9bf4.tar.gz
aes-tools-1dd052e86fa45a215b68152977e0c7888eba9bf4.zip
add CFB mode
Diffstat (limited to '')
-rw-r--r--include/aesni/api.h48
1 files changed, 48 insertions, 0 deletions
diff --git a/include/aesni/api.h b/include/aesni/api.h
index 72e689b..6e30b65 100644
--- a/include/aesni/api.h
+++ b/include/aesni/api.h
@@ -55,6 +55,22 @@ static __inline AesBlock128 __fastcall aes128cbc_decrypt(
return _mm_xor_si128(raw_aes128ecb_decrypt(cypher, inverted_schedule), init_vector);
}
+static __inline AesBlock128 __fastcall aes128cfb_encrypt(
+ AesBlock128 plain,
+ Aes128KeySchedule* key_schedule,
+ AesBlock128 init_vector)
+{
+ return _mm_xor_si128(raw_aes128ecb_encrypt(init_vector, key_schedule), plain);
+}
+
+static __inline AesBlock128 __fastcall aes128cfb_decrypt(
+ AesBlock128 cypher,
+ Aes128KeySchedule* key_schedule,
+ AesBlock128 init_vector)
+{
+ return _mm_xor_si128(raw_aes128ecb_encrypt(init_vector, key_schedule), cypher);
+}
+
static __inline void __fastcall aes192_expand_key_schedule(
AesBlock192* key,
Aes192KeySchedule* key_schedule)
@@ -99,6 +115,22 @@ static __inline AesBlock128 __fastcall aes192cbc_decrypt(
return _mm_xor_si128(raw_aes192ecb_decrypt(cypher, inverted_schedule), init_vector);
}
+static __inline AesBlock128 __fastcall aes192cfb_encrypt(
+ AesBlock128 plain,
+ Aes192KeySchedule* key_schedule,
+ AesBlock128 init_vector)
+{
+ return _mm_xor_si128(raw_aes192ecb_encrypt(init_vector, key_schedule), plain);
+}
+
+static __inline AesBlock128 __fastcall aes192cfb_decrypt(
+ AesBlock128 cypher,
+ Aes192KeySchedule* key_schedule,
+ AesBlock128 init_vector)
+{
+ return _mm_xor_si128(raw_aes192ecb_encrypt(init_vector, key_schedule), cypher);
+}
+
static __inline void __fastcall aes256_expand_key_schedule(
AesBlock256* key,
Aes256KeySchedule* key_schedule)
@@ -142,3 +174,19 @@ static __inline AesBlock128 __fastcall aes256cbc_decrypt(
{
return _mm_xor_si128(raw_aes256ecb_decrypt(cypher, inverted_schedule), init_vector);
}
+
+static __inline AesBlock128 __fastcall aes256cfb_encrypt(
+ AesBlock128 plain,
+ Aes256KeySchedule* key_schedule,
+ AesBlock128 init_vector)
+{
+ return _mm_xor_si128(raw_aes256ecb_encrypt(init_vector, key_schedule), plain);
+}
+
+static __inline AesBlock128 __fastcall aes256cfb_decrypt(
+ AesBlock128 cypher,
+ Aes256KeySchedule* key_schedule,
+ AesBlock128 init_vector)
+{
+ return _mm_xor_si128(raw_aes256ecb_encrypt(init_vector, key_schedule), cypher);
+}