aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/include/aesni/api.h
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2015-06-03 22:36:04 +0300
committerEgor Tensin <Egor.Tensin@gmail.com>2015-06-03 22:36:04 +0300
commit1bd0b66128ab1b2b2cd6476fd378a6e304a769be (patch)
tree59c00603bbc4580df27c603a9ce2dc6ab4882def /include/aesni/api.h
parentexamples: no more FIPS-style one-line blocks (diff)
downloadaes-tools-1bd0b66128ab1b2b2cd6476fd378a6e304a769be.tar.gz
aes-tools-1bd0b66128ab1b2b2cd6476fd378a6e304a769be.zip
add OFB mode
Diffstat (limited to 'include/aesni/api.h')
-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 6e30b65..6d275a5 100644
--- a/include/aesni/api.h
+++ b/include/aesni/api.h
@@ -71,6 +71,22 @@ static __inline AesBlock128 __fastcall aes128cfb_decrypt(
return _mm_xor_si128(raw_aes128ecb_encrypt(init_vector, key_schedule), cypher);
}
+static __inline AesBlock128 __fastcall aes128ofb_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 aes128ofb_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)
@@ -131,6 +147,22 @@ static __inline AesBlock128 __fastcall aes192cfb_decrypt(
return _mm_xor_si128(raw_aes192ecb_encrypt(init_vector, key_schedule), cypher);
}
+static __inline AesBlock128 __fastcall aes192ofb_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 aes192ofb_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)
@@ -190,3 +222,19 @@ static __inline AesBlock128 __fastcall aes256cfb_decrypt(
{
return _mm_xor_si128(raw_aes256ecb_encrypt(init_vector, key_schedule), cypher);
}
+
+static __inline AesBlock128 __fastcall aes256ofb_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 aes256ofb_decrypt(
+ AesBlock128 cypher,
+ Aes256KeySchedule* key_schedule,
+ AesBlock128 init_vector)
+{
+ return _mm_xor_si128(raw_aes256ecb_encrypt(init_vector, key_schedule), cypher);
+}