diff options
author | lloyd <[email protected]> | 2010-10-14 18:04:35 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2010-10-14 18:04:35 +0000 |
commit | 0cb6bcfedef6ffa797801acd7cb945feb2d05d50 (patch) | |
tree | a89de84b769036989fd59364dfb2d4fa000c697f /src/block/cast | |
parent | a142500346e9bef5c4b0905103eac9a494d6822e (diff) |
In all cases where the block size of the cipher is fixed, the key
parameters are as well. So make them template paramters.
The sole exception was AES, because you could either initialize AES
with a fixed key length, in which case it would only be that specific
key length, or not, in which case it would support any valid AES key
size. This is removed in this checkin; you have to specifically ask for
AES-128, AES-192, or AES-256, depending on which one you want.
This is probably actually a good thing, because every implementation
other than the base one (SSSE3, AES-NI, OpenSSL) did not support
"AES", only the versions with specific fixed key sizes. So forcing
the user to ask for the one they want ensures they get the ones
that are faster and/or safer.
Diffstat (limited to 'src/block/cast')
-rw-r--r-- | src/block/cast/cast128.h | 4 | ||||
-rw-r--r-- | src/block/cast/cast256.h | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/src/block/cast/cast128.h b/src/block/cast/cast128.h index 3ecbcaa5a..10c646c94 100644 --- a/src/block/cast/cast128.h +++ b/src/block/cast/cast128.h @@ -15,7 +15,7 @@ namespace Botan { /** * CAST-128 */ -class BOTAN_DLL CAST_128 : public BlockCipher_Fixed_Block_Size<8> +class BOTAN_DLL CAST_128 : public Block_Cipher_Fixed_Params<8, 11, 16> { public: void encrypt_n(const byte in[], byte out[], size_t blocks) const; @@ -25,7 +25,7 @@ class BOTAN_DLL CAST_128 : public BlockCipher_Fixed_Block_Size<8> std::string name() const { return "CAST-128"; } BlockCipher* clone() const { return new CAST_128; } - CAST_128() : BlockCipher_Fixed_Block_Size(11, 16), MK(16), RK(16) {} + CAST_128() : MK(16), RK(16) {} private: void key_schedule(const byte[], size_t); diff --git a/src/block/cast/cast256.h b/src/block/cast/cast256.h index 0dda7f0d7..2f2beef47 100644 --- a/src/block/cast/cast256.h +++ b/src/block/cast/cast256.h @@ -15,7 +15,7 @@ namespace Botan { /** * CAST-256 */ -class BOTAN_DLL CAST_256 : public BlockCipher_Fixed_Block_Size<16> +class BOTAN_DLL CAST_256 : public Block_Cipher_Fixed_Params<16, 4, 32, 4> { public: void encrypt_n(const byte in[], byte out[], size_t blocks) const; @@ -25,7 +25,7 @@ class BOTAN_DLL CAST_256 : public BlockCipher_Fixed_Block_Size<16> std::string name() const { return "CAST-256"; } BlockCipher* clone() const { return new CAST_256; } - CAST_256() : BlockCipher_Fixed_Block_Size(4, 32, 4), MK(48), RK(48) {} + CAST_256() : MK(48), RK(48) {} private: void key_schedule(const byte[], size_t); |