From be73bf2a3ff7ed61a7f58117cca00ab220ede52b Mon Sep 17 00:00:00 2001 From: lloyd Date: Thu, 25 Feb 2010 06:15:04 +0000 Subject: Set parallelism defaults. Default unless specified is now 4. For SIMD code, use 2x the number of blocks which are processed in parallel using SIMD by that cipher. It may make sense to increase this to 4x or even more, further experimentation is necessary. --- src/block/aes_intel/aes_intel.h | 6 ++++++ src/block/block_cipher.h | 2 +- src/block/idea_sse2/idea_sse2.h | 2 ++ src/block/noekeon_simd/noekeon_simd.h | 2 ++ src/block/serpent_simd/serp_simd.h | 2 ++ src/block/xtea_simd/xtea_simd.h | 2 ++ 6 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/block/aes_intel/aes_intel.h b/src/block/aes_intel/aes_intel.h index 164655072..239516e24 100644 --- a/src/block/aes_intel/aes_intel.h +++ b/src/block/aes_intel/aes_intel.h @@ -18,6 +18,8 @@ namespace Botan { class BOTAN_DLL AES_128_Intel : public BlockCipher { public: + u32bit parallelism() const { return 8; } + void encrypt_n(const byte in[], byte out[], u32bit blocks) const; void decrypt_n(const byte in[], byte out[], u32bit blocks) const; @@ -38,6 +40,8 @@ class BOTAN_DLL AES_128_Intel : public BlockCipher class BOTAN_DLL AES_192_Intel : public BlockCipher { public: + u32bit parallelism() const { return 8; } + void encrypt_n(const byte in[], byte out[], u32bit blocks) const; void decrypt_n(const byte in[], byte out[], u32bit blocks) const; @@ -58,6 +62,8 @@ class BOTAN_DLL AES_192_Intel : public BlockCipher class BOTAN_DLL AES_256_Intel : public BlockCipher { public: + u32bit parallelism() const { return 8; } + void encrypt_n(const byte in[], byte out[], u32bit blocks) const; void decrypt_n(const byte in[], byte out[], u32bit blocks) const; diff --git a/src/block/block_cipher.h b/src/block/block_cipher.h index b3e1b0e31..2d9198c58 100644 --- a/src/block/block_cipher.h +++ b/src/block/block_cipher.h @@ -26,7 +26,7 @@ class BOTAN_DLL BlockCipher : public SymmetricAlgorithm /** * @return the preferred parallelism of this cipher */ - virtual u32bit parallelism() const { return 1; } + virtual u32bit parallelism() const { return 4; } /** * Encrypt a block. diff --git a/src/block/idea_sse2/idea_sse2.h b/src/block/idea_sse2/idea_sse2.h index 167c981f8..657581d74 100644 --- a/src/block/idea_sse2/idea_sse2.h +++ b/src/block/idea_sse2/idea_sse2.h @@ -18,6 +18,8 @@ namespace Botan { class BOTAN_DLL IDEA_SSE2 : public IDEA { public: + u32bit parallelism() const { return 16; } + void encrypt_n(const byte in[], byte out[], u32bit blocks) const; void decrypt_n(const byte in[], byte out[], u32bit blocks) const; diff --git a/src/block/noekeon_simd/noekeon_simd.h b/src/block/noekeon_simd/noekeon_simd.h index 466c4b741..55fdfbd22 100644 --- a/src/block/noekeon_simd/noekeon_simd.h +++ b/src/block/noekeon_simd/noekeon_simd.h @@ -18,6 +18,8 @@ namespace Botan { class BOTAN_DLL Noekeon_SIMD : public Noekeon { public: + u32bit parallelism() const { return 8; } + void encrypt_n(const byte in[], byte out[], u32bit blocks) const; void decrypt_n(const byte in[], byte out[], u32bit blocks) const; diff --git a/src/block/serpent_simd/serp_simd.h b/src/block/serpent_simd/serp_simd.h index 1ecb70159..dc2b08736 100644 --- a/src/block/serpent_simd/serp_simd.h +++ b/src/block/serpent_simd/serp_simd.h @@ -18,6 +18,8 @@ namespace Botan { class BOTAN_DLL Serpent_SIMD : public Serpent { public: + u32bit parallelism() const { return 8; } + void encrypt_n(const byte in[], byte out[], u32bit blocks) const; void decrypt_n(const byte in[], byte out[], u32bit blocks) const; diff --git a/src/block/xtea_simd/xtea_simd.h b/src/block/xtea_simd/xtea_simd.h index e4ce734ed..04a4977ae 100644 --- a/src/block/xtea_simd/xtea_simd.h +++ b/src/block/xtea_simd/xtea_simd.h @@ -18,6 +18,8 @@ namespace Botan { class BOTAN_DLL XTEA_SIMD : public XTEA { public: + u32bit parallelism() const { return 16; } + void encrypt_n(const byte in[], byte out[], u32bit blocks) const; void decrypt_n(const byte in[], byte out[], u32bit blocks) const; BlockCipher* clone() const { return new XTEA_SIMD; } -- cgit v1.2.3