aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/include
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2015-06-04 16:38:02 +0300
committerEgor Tensin <Egor.Tensin@gmail.com>2015-06-04 16:38:02 +0300
commit9e02414683bf3b419356155f2cbd20d393dd6040 (patch)
treed20fe8fe74ea70bfd28756babde96211cd5a182f /include
parentgrammar tweaks (diff)
downloadaes-tools-9e02414683bf3b419356155f2cbd20d393dd6040.tar.gz
aes-tools-9e02414683bf3b419356155f2cbd20d393dd6040.zip
refactoring
Diffstat (limited to '')
-rw-r--r--include/aesni/data.h19
1 files changed, 15 insertions, 4 deletions
diff --git a/include/aesni/data.h b/include/aesni/data.h
index 4ed9f9f..1a192fc 100644
--- a/include/aesni/data.h
+++ b/include/aesni/data.h
@@ -12,6 +12,11 @@
typedef __m128i AesBlock128;
+static __inline AesBlock128 __fastcall make_aes_block128(int hi3, int hi2, int lo1, int lo0)
+{
+ return _mm_set_epi32(hi3, hi2, lo1, lo0);
+}
+
typedef struct
{
AesBlock128 hi;
@@ -19,6 +24,11 @@ typedef struct
}
AesBlock192;
+static __inline AesBlock192 __fastcall make_aes_block192(int hi5, int hi4, int lo3, int lo2, int lo1, int lo0)
+{
+ return (AesBlock192) { .hi = make_aes_block128(0, 0, hi5, hi4), .lo = make_aes_block128(lo3, lo2, lo1, lo0) };
+}
+
typedef struct
{
AesBlock128 hi;
@@ -26,6 +36,11 @@ typedef struct
}
AesBlock256;
+static __inline AesBlock256 __fastcall make_aes_block256(int hi7, int hi6, int hi5, int hi4, int lo3, int lo2, int lo1, int lo0)
+{
+ return (AesBlock256) { .hi = make_aes_block128(hi7, hi6, hi5, hi4), .lo = make_aes_block128(lo3, lo2, lo1, lo0) };
+}
+
typedef struct
{
AesBlock128 keys[11];
@@ -57,10 +72,6 @@ static __inline AesBlock128 __fastcall aes128_be2le(AesBlock128 block)
return aes128_le2be(block);
}
-AesBlock128 make_aes_block128(int hi3, int hi2, int lo1, int lo0);
-AesBlock192 make_aes_block192(int hi5, int hi4, int lo3, int lo2, int lo1, int lo0);
-AesBlock256 make_aes_block256(int hi7, int hi6, int hi5, int hi4, int lo3, int lo2, int lo1, int lo0);
-
typedef struct { char str[33]; } AesBlockString128;
typedef struct { char str[49]; } AesBlockString192;
typedef struct { char str[65]; } AesBlockString256;