diff options
author | Jack Lloyd <[email protected]> | 2016-07-24 05:32:30 -0400 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2016-09-02 05:29:09 -0400 |
commit | d365e37c504ae884af325f4e21de2e9f85e05e82 (patch) | |
tree | 92f944a877cc7fad27032cb384d5e049d0c7ecb2 /src | |
parent | fb84ed67c616928354999b285f3ee4fb486f0f5b (diff) |
Remove XTEA SIMD impl
Testing showed no actual speedup on either i7 (SSE2) or POWER7 (Altivec),
so it is just dead weight.
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/block/xtea_simd/info.txt | 6 | ||||
-rw-r--r-- | src/lib/block/xtea_simd/xtea_simd.cpp | 129 | ||||
-rw-r--r-- | src/lib/block/xtea_simd/xtea_simd.h | 30 |
3 files changed, 0 insertions, 165 deletions
diff --git a/src/lib/block/xtea_simd/info.txt b/src/lib/block/xtea_simd/info.txt deleted file mode 100644 index 01fb4110d..000000000 --- a/src/lib/block/xtea_simd/info.txt +++ /dev/null @@ -1,6 +0,0 @@ -define XTEA_SIMD 20131128 - -<requires> -xtea -simd -</requires> diff --git a/src/lib/block/xtea_simd/xtea_simd.cpp b/src/lib/block/xtea_simd/xtea_simd.cpp deleted file mode 100644 index 6e50f4ff7..000000000 --- a/src/lib/block/xtea_simd/xtea_simd.cpp +++ /dev/null @@ -1,129 +0,0 @@ -/* -* XTEA in SIMD -* (C) 2009 Jack Lloyd -* -* Botan is released under the Simplified BSD License (see license.txt) -*/ - -#include <botan/xtea_simd.h> -#include <botan/internal/simd_32.h> - -namespace Botan { - -namespace { - -void xtea_encrypt_8(const byte in[64], byte out[64], const u32bit EK[64]) - { - SIMD_32 L0 = SIMD_32::load_be(in ); - SIMD_32 R0 = SIMD_32::load_be(in + 16); - SIMD_32 L1 = SIMD_32::load_be(in + 32); - SIMD_32 R1 = SIMD_32::load_be(in + 48); - - SIMD_32::transpose(L0, R0, L1, R1); - - for(size_t i = 0; i != 32; i += 2) - { - SIMD_32 K0(EK[2*i ]); - SIMD_32 K1(EK[2*i+1]); - SIMD_32 K2(EK[2*i+2]); - SIMD_32 K3(EK[2*i+3]); - - L0 += (((R0 << 4) ^ (R0 >> 5)) + R0) ^ K0; - L1 += (((R1 << 4) ^ (R1 >> 5)) + R1) ^ K0; - - R0 += (((L0 << 4) ^ (L0 >> 5)) + L0) ^ K1; - R1 += (((L1 << 4) ^ (L1 >> 5)) + L1) ^ K1; - - L0 += (((R0 << 4) ^ (R0 >> 5)) + R0) ^ K2; - L1 += (((R1 << 4) ^ (R1 >> 5)) + R1) ^ K2; - - R0 += (((L0 << 4) ^ (L0 >> 5)) + L0) ^ K3; - R1 += (((L1 << 4) ^ (L1 >> 5)) + L1) ^ K3; - } - - SIMD_32::transpose(L0, R0, L1, R1); - - L0.store_be(out); - R0.store_be(out + 16); - L1.store_be(out + 32); - R1.store_be(out + 48); - } - -void xtea_decrypt_8(const byte in[64], byte out[64], const u32bit EK[64]) - { - SIMD_32 L0 = SIMD_32::load_be(in ); - SIMD_32 R0 = SIMD_32::load_be(in + 16); - SIMD_32 L1 = SIMD_32::load_be(in + 32); - SIMD_32 R1 = SIMD_32::load_be(in + 48); - - SIMD_32::transpose(L0, R0, L1, R1); - - for(size_t i = 0; i != 32; i += 2) - { - SIMD_32 K0(EK[63 - 2*i]); - SIMD_32 K1(EK[62 - 2*i]); - SIMD_32 K2(EK[61 - 2*i]); - SIMD_32 K3(EK[60 - 2*i]); - - R0 -= (((L0 << 4) ^ (L0 >> 5)) + L0) ^ K0; - R1 -= (((L1 << 4) ^ (L1 >> 5)) + L1) ^ K0; - - L0 -= (((R0 << 4) ^ (R0 >> 5)) + R0) ^ K1; - L1 -= (((R1 << 4) ^ (R1 >> 5)) + R1) ^ K1; - - R0 -= (((L0 << 4) ^ (L0 >> 5)) + L0) ^ K2; - R1 -= (((L1 << 4) ^ (L1 >> 5)) + L1) ^ K2; - - L0 -= (((R0 << 4) ^ (R0 >> 5)) + R0) ^ K3; - L1 -= (((R1 << 4) ^ (R1 >> 5)) + R1) ^ K3; - } - - SIMD_32::transpose(L0, R0, L1, R1); - - L0.store_be(out); - R0.store_be(out + 16); - L1.store_be(out + 32); - R1.store_be(out + 48); - } - -} - -/* -* XTEA Encryption -*/ -void XTEA_SIMD::encrypt_n(const byte in[], byte out[], size_t blocks) const - { - const u32bit* KS = &(this->get_EK()[0]); - - while(blocks >= 8) - { - xtea_encrypt_8(in, out, KS); - in += 8 * BLOCK_SIZE; - out += 8 * BLOCK_SIZE; - blocks -= 8; - } - - if(blocks) - XTEA::encrypt_n(in, out, blocks); - } - -/* -* XTEA Decryption -*/ -void XTEA_SIMD::decrypt_n(const byte in[], byte out[], size_t blocks) const - { - const u32bit* KS = &(this->get_EK()[0]); - - while(blocks >= 8) - { - xtea_decrypt_8(in, out, KS); - in += 8 * BLOCK_SIZE; - out += 8 * BLOCK_SIZE; - blocks -= 8; - } - - if(blocks) - XTEA::decrypt_n(in, out, blocks); - } - -} diff --git a/src/lib/block/xtea_simd/xtea_simd.h b/src/lib/block/xtea_simd/xtea_simd.h deleted file mode 100644 index 0b0558032..000000000 --- a/src/lib/block/xtea_simd/xtea_simd.h +++ /dev/null @@ -1,30 +0,0 @@ -/* -* XTEA in SIMD -* (C) 2009 Jack Lloyd -* -* Botan is released under the Simplified BSD License (see license.txt) -*/ - -#ifndef BOTAN_XTEA_SIMD_H__ -#define BOTAN_XTEA_SIMD_H__ - -#include <botan/xtea.h> - -namespace Botan { - -/** -* XTEA implemented using SIMD operations -*/ -class BOTAN_DLL XTEA_SIMD final : public XTEA - { - public: - size_t parallelism() const override { return 8; } - - void encrypt_n(const byte in[], byte out[], size_t blocks) const override; - void decrypt_n(const byte in[], byte out[], size_t blocks) const override; - BlockCipher* clone() const override { return new XTEA_SIMD; } - }; - -} - -#endif |