aboutsummaryrefslogtreecommitdiffstats
path: root/src/block/aes_ssse3/aes_ssse3.h
diff options
context:
space:
mode:
authorlloyd <[email protected]>2010-10-13 13:09:56 +0000
committerlloyd <[email protected]>2010-10-13 13:09:56 +0000
commit55550067fd69850c767cc9800433e1eabfeb5da2 (patch)
tree80ccea320ba00be2f7942d88657937462a6b1f03 /src/block/aes_ssse3/aes_ssse3.h
parent85a504e310666f270a3a67edf4cdac06c34c61b9 (diff)
Add a new subclass for BlockCipher BlockCipher_Fixed_Block_Size, which
sets the block size statically and also creates an enum with the size. Use the enum instead of calling block_size() where possible, since that uses two virtual function calls per block which is quite unfortunate. The real advantages here as compared to the previous version which kept the block size as a per-object u32bit: - The compiler can inline the constant as an immediate operand (previously it would load the value via an indirection on this) - Removes 32 bits per object overhead (except in cases with actually variable block sizes, which are very few and rarely used)
Diffstat (limited to 'src/block/aes_ssse3/aes_ssse3.h')
-rw-r--r--src/block/aes_ssse3/aes_ssse3.h15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/block/aes_ssse3/aes_ssse3.h b/src/block/aes_ssse3/aes_ssse3.h
index 0cdb5f4de..59bb85f12 100644
--- a/src/block/aes_ssse3/aes_ssse3.h
+++ b/src/block/aes_ssse3/aes_ssse3.h
@@ -15,7 +15,7 @@ namespace Botan {
/**
* AES-128 using SSSE3
*/
-class BOTAN_DLL AES_128_SSSE3 : public BlockCipher
+class BOTAN_DLL AES_128_SSSE3 : public BlockCipher_Fixed_Block_Size<16>
{
public:
void encrypt_n(const byte in[], byte out[], size_t blocks) const;
@@ -25,7 +25,8 @@ class BOTAN_DLL AES_128_SSSE3 : public BlockCipher
std::string name() const { return "AES-128"; }
BlockCipher* clone() const { return new AES_128_SSSE3; }
- AES_128_SSSE3() : BlockCipher(16, 16), EK(44), DK(44) {}
+ AES_128_SSSE3() : BlockCipher_Fixed_Block_Size(16),
+ EK(44), DK(44) {}
private:
void key_schedule(const byte[], size_t);
@@ -35,7 +36,7 @@ class BOTAN_DLL AES_128_SSSE3 : public BlockCipher
/**
* AES-192 using SSSE3
*/
-class BOTAN_DLL AES_192_SSSE3 : public BlockCipher
+class BOTAN_DLL AES_192_SSSE3 : public BlockCipher_Fixed_Block_Size<16>
{
public:
void encrypt_n(const byte in[], byte out[], size_t blocks) const;
@@ -45,7 +46,8 @@ class BOTAN_DLL AES_192_SSSE3 : public BlockCipher
std::string name() const { return "AES-192"; }
BlockCipher* clone() const { return new AES_192_SSSE3; }
- AES_192_SSSE3() : BlockCipher(16, 24), EK(52), DK(52) {}
+ AES_192_SSSE3() : BlockCipher_Fixed_Block_Size(24),
+ EK(52), DK(52) {}
private:
void key_schedule(const byte[], size_t);
@@ -55,7 +57,7 @@ class BOTAN_DLL AES_192_SSSE3 : public BlockCipher
/**
* AES-256 using SSSE3
*/
-class BOTAN_DLL AES_256_SSSE3 : public BlockCipher
+class BOTAN_DLL AES_256_SSSE3 : public BlockCipher_Fixed_Block_Size<16>
{
public:
void encrypt_n(const byte in[], byte out[], size_t blocks) const;
@@ -65,7 +67,8 @@ class BOTAN_DLL AES_256_SSSE3 : public BlockCipher
std::string name() const { return "AES-256"; }
BlockCipher* clone() const { return new AES_256_SSSE3; }
- AES_256_SSSE3() : BlockCipher(16, 32), EK(60), DK(60) {}
+ AES_256_SSSE3() : BlockCipher_Fixed_Block_Size(32),
+ EK(60), DK(60) {}
private:
void key_schedule(const byte[], size_t);