aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/block/idea_sse2/idea_sse2.cpp
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2016-09-03 14:17:33 -0400
committerJack Lloyd <[email protected]>2016-09-15 09:23:22 -0400
commitbe4655148cfc8cb048fd53de0965cc5e939c4cbc (patch)
treed441a6a5941d968fce80dd50a5f6010855714a77 /src/lib/block/idea_sse2/idea_sse2.cpp
parent272fcf00572432f64085b10132e364740d7eb093 (diff)
Merge optimized implementations into base class
Various algorithms had an optimized implementation (for SSE2, AVX2, etc) which was offered alongside the 'base' implementation. This is admittedly very useful for testing, but it breaks user expectations in bad ways. See GH #477 for background. Now encrypting with `AES_128` (say) just runs whatever implementation is best on the current processor/build.
Diffstat (limited to 'src/lib/block/idea_sse2/idea_sse2.cpp')
-rw-r--r--src/lib/block/idea_sse2/idea_sse2.cpp49
1 files changed, 5 insertions, 44 deletions
diff --git a/src/lib/block/idea_sse2/idea_sse2.cpp b/src/lib/block/idea_sse2/idea_sse2.cpp
index c7d846e8b..4debfc95a 100644
--- a/src/lib/block/idea_sse2/idea_sse2.cpp
+++ b/src/lib/block/idea_sse2/idea_sse2.cpp
@@ -5,8 +5,7 @@
* Botan is released under the Simplified BSD License (see license.txt)
*/
-#include <botan/idea_sse2.h>
-#include <botan/cpuid.h>
+#include <botan/idea.h>
#include <botan/internal/ct_utils.h>
#include <emmintrin.h>
@@ -126,10 +125,12 @@ void transpose_out(__m128i& B0, __m128i& B1, __m128i& B2, __m128i& B3)
B3 = _mm_unpackhi_epi32(T2, T3);
}
+}
+
/*
-* IDEA encryption/decryption in SSE2
+* 8 wide IDEA encryption/decryption in SSE2
*/
-void idea_op_8(const byte in[64], byte out[64], const u16bit EK[52])
+void IDEA::sse2_idea_op_8(const byte in[64], byte out[64], const u16bit EK[52]) const
{
CT::poison(in, 64);
CT::poison(out, 64);
@@ -201,43 +202,3 @@ void idea_op_8(const byte in[64], byte out[64], const u16bit EK[52])
}
}
-
-/*
-* IDEA Encryption
-*/
-void IDEA_SSE2::encrypt_n(const byte in[], byte out[], size_t blocks) const
- {
- const u16bit* KS = &this->get_EK()[0];
-
- while(blocks >= 8)
- {
- idea_op_8(in, out, KS);
- in += 8 * BLOCK_SIZE;
- out += 8 * BLOCK_SIZE;
- blocks -= 8;
- }
-
- if(blocks)
- IDEA::encrypt_n(in, out, blocks);
- }
-
-/*
-* IDEA Decryption
-*/
-void IDEA_SSE2::decrypt_n(const byte in[], byte out[], size_t blocks) const
- {
- const u16bit* KS = &this->get_DK()[0];
-
- while(blocks >= 8)
- {
- idea_op_8(in, out, KS);
- in += 8 * BLOCK_SIZE;
- out += 8 * BLOCK_SIZE;
- blocks -= 8;
- }
-
- if(blocks)
- IDEA::decrypt_n(in, out, blocks);
- }
-
-}