diff options
author | Egor Tensin <Egor.Tensin@gmail.com> | 2015-06-04 03:18:01 +0300 |
---|---|---|
committer | Egor Tensin <Egor.Tensin@gmail.com> | 2015-06-04 03:18:01 +0300 |
commit | c3537aaeb9fd34731c9772e4fd72baa586684d10 (patch) | |
tree | 28a3be6408e7b43776a485cc49fee368cd168119 /include/aesni | |
parent | init vectors are calculated by API functions (diff) | |
download | aes-tools-c3537aaeb9fd34731c9772e4fd72baa586684d10.tar.gz aes-tools-c3537aaeb9fd34731c9772e4fd72baa586684d10.zip |
add BE-to-LE conversion functions
Diffstat (limited to 'include/aesni')
-rw-r--r-- | include/aesni/data.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/include/aesni/data.h b/include/aesni/data.h index dec9367..4ed9f9f 100644 --- a/include/aesni/data.h +++ b/include/aesni/data.h @@ -45,6 +45,18 @@ typedef struct } Aes256KeySchedule; +static __inline AesBlock128 __fastcall aes128_le2be(AesBlock128 block) +{ + __declspec(align(16)) char xs[16]; + _mm_store_si128((__m128i*) xs, block); + return _mm_set_epi8(xs[0], xs[1], xs[2], xs[3], xs[4], xs[5], xs[6], xs[7], xs[8], xs[9], xs[10], xs[11], xs[12], xs[13], xs[14], xs[15]); +} + +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); |