diff options
Diffstat (limited to 'src/lib/block/aes_ssse3/aes_ssse3.cpp')
-rw-r--r-- | src/lib/block/aes_ssse3/aes_ssse3.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/lib/block/aes_ssse3/aes_ssse3.cpp b/src/lib/block/aes_ssse3/aes_ssse3.cpp index eda39a7cc..ef24795bb 100644 --- a/src/lib/block/aes_ssse3/aes_ssse3.cpp +++ b/src/lib/block/aes_ssse3/aes_ssse3.cpp @@ -51,6 +51,7 @@ const __m128i sr[4] = { #define mm_xor3(x, y, z) _mm_xor_si128(x, _mm_xor_si128(y, z)) +BOTAN_FUNC_ISA("ssse3") __m128i aes_schedule_transform(__m128i input, __m128i table_1, __m128i table_2) @@ -63,6 +64,7 @@ __m128i aes_schedule_transform(__m128i input, _mm_shuffle_epi8(table_2, i_2)); } +BOTAN_FUNC_ISA("ssse3") __m128i aes_schedule_mangle(__m128i k, byte round_no) { __m128i t = _mm_shuffle_epi8(_mm_xor_si128(k, _mm_set1_epi8(0x5B)), @@ -77,6 +79,7 @@ __m128i aes_schedule_mangle(__m128i k, byte round_no) return _mm_shuffle_epi8(t2, sr[round_no % 4]); } +BOTAN_FUNC_ISA("ssse3") __m128i aes_schedule_192_smear(__m128i x, __m128i y) { return mm_xor3(y, @@ -84,6 +87,7 @@ __m128i aes_schedule_192_smear(__m128i x, __m128i y) _mm_shuffle_epi32(y, 0x80)); } +BOTAN_FUNC_ISA("ssse3") __m128i aes_schedule_mangle_dec(__m128i k, byte round_no) { const __m128i dsk[8] = { @@ -112,6 +116,7 @@ __m128i aes_schedule_mangle_dec(__m128i k, byte round_no) return _mm_shuffle_epi8(output, sr[round_no % 4]); } +BOTAN_FUNC_ISA("ssse3") __m128i aes_schedule_mangle_last(__m128i k, byte round_no) { const __m128i out_tr1 = _mm_set_epi32( @@ -124,6 +129,7 @@ __m128i aes_schedule_mangle_last(__m128i k, byte round_no) return aes_schedule_transform(k, out_tr1, out_tr2); } +BOTAN_FUNC_ISA("ssse3") __m128i aes_schedule_mangle_last_dec(__m128i k) { const __m128i deskew1 = _mm_set_epi32( @@ -135,6 +141,7 @@ __m128i aes_schedule_mangle_last_dec(__m128i k) return aes_schedule_transform(k, deskew1, deskew2); } +BOTAN_FUNC_ISA("ssse3") __m128i aes_schedule_round(__m128i* rcon, __m128i input1, __m128i input2) { if(rcon) @@ -170,6 +177,7 @@ __m128i aes_schedule_round(__m128i* rcon, __m128i input1, __m128i input2) smeared); } +BOTAN_FUNC_ISA("ssse3") __m128i aes_ssse3_encrypt(__m128i B, const __m128i* keys, size_t rounds) { const __m128i sb2u = _mm_set_epi32( @@ -239,6 +247,7 @@ __m128i aes_ssse3_encrypt(__m128i B, const __m128i* keys, size_t rounds) } } +BOTAN_FUNC_ISA("ssse3") __m128i aes_ssse3_decrypt(__m128i B, const __m128i* keys, size_t rounds) { const __m128i k_dipt1 = _mm_set_epi32( @@ -336,6 +345,7 @@ __m128i aes_ssse3_decrypt(__m128i B, const __m128i* keys, size_t rounds) /* * AES-128 Encryption */ +BOTAN_FUNC_ISA("ssse3") void AES_128::ssse3_encrypt_n(const byte in[], byte out[], size_t blocks) const { const __m128i* in_mm = reinterpret_cast<const __m128i*>(in); @@ -358,6 +368,7 @@ void AES_128::ssse3_encrypt_n(const byte in[], byte out[], size_t blocks) const /* * AES-128 Decryption */ +BOTAN_FUNC_ISA("ssse3") void AES_128::ssse3_decrypt_n(const byte in[], byte out[], size_t blocks) const { const __m128i* in_mm = reinterpret_cast<const __m128i*>(in); @@ -380,6 +391,7 @@ void AES_128::ssse3_decrypt_n(const byte in[], byte out[], size_t blocks) const /* * AES-128 Key Schedule */ +BOTAN_FUNC_ISA("ssse3") void AES_128::ssse3_key_schedule(const byte keyb[], size_t) { __m128i rcon = _mm_set_epi32(0x702A9808, 0x4D7C7D81, @@ -418,6 +430,7 @@ void AES_128::ssse3_key_schedule(const byte keyb[], size_t) /* * AES-192 Encryption */ +BOTAN_FUNC_ISA("ssse3") void AES_192::ssse3_encrypt_n(const byte in[], byte out[], size_t blocks) const { const __m128i* in_mm = reinterpret_cast<const __m128i*>(in); @@ -440,6 +453,7 @@ void AES_192::ssse3_encrypt_n(const byte in[], byte out[], size_t blocks) const /* * AES-192 Decryption */ +BOTAN_FUNC_ISA("ssse3") void AES_192::ssse3_decrypt_n(const byte in[], byte out[], size_t blocks) const { const __m128i* in_mm = reinterpret_cast<const __m128i*>(in); @@ -462,6 +476,7 @@ void AES_192::ssse3_decrypt_n(const byte in[], byte out[], size_t blocks) const /* * AES-192 Key Schedule */ +BOTAN_FUNC_ISA("ssse3") void AES_192::ssse3_key_schedule(const byte keyb[], size_t) { __m128i rcon = _mm_set_epi32(0x702A9808, 0x4D7C7D81, @@ -529,6 +544,7 @@ void AES_192::ssse3_key_schedule(const byte keyb[], size_t) /* * AES-256 Encryption */ +BOTAN_FUNC_ISA("ssse3") void AES_256::ssse3_encrypt_n(const byte in[], byte out[], size_t blocks) const { const __m128i* in_mm = reinterpret_cast<const __m128i*>(in); @@ -551,6 +567,7 @@ void AES_256::ssse3_encrypt_n(const byte in[], byte out[], size_t blocks) const /* * AES-256 Decryption */ +BOTAN_FUNC_ISA("ssse3") void AES_256::ssse3_decrypt_n(const byte in[], byte out[], size_t blocks) const { const __m128i* in_mm = reinterpret_cast<const __m128i*>(in); @@ -573,6 +590,7 @@ void AES_256::ssse3_decrypt_n(const byte in[], byte out[], size_t blocks) const /* * AES-256 Key Schedule */ +BOTAN_FUNC_ISA("ssse3") void AES_256::ssse3_key_schedule(const byte keyb[], size_t) { __m128i rcon = _mm_set_epi32(0x702A9808, 0x4D7C7D81, |