diff options
author | lloyd <[email protected]> | 2015-01-28 04:32:10 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2015-01-28 04:32:10 +0000 |
commit | 7b56f1bd570dc684ffd7c945dee0d9b5480354ff (patch) | |
tree | 0c50ad534280a292a1b76daee9a19b34cfd96367 /src/lib/block/misty1 | |
parent | b8fa304ec981d273c45d7ef31705d65ccfb00cc1 (diff) |
Add a runtime map of string->func() which when called return
Transforms and BlockCiphers. Registration for all types is done at
startup but is very cheap as just a std::function and a std::map entry
are created, no actual objects are created until needed. This is a
huge improvement over Algorithm_Factory which used T::clone() as the
function and thus kept a prototype object of each type in memory.
Replace existing lookup mechanisms for ciphers, AEADs, and compression
to use the transform lookup. The existing Engine framework remains in
place for BlockCipher, but the engines now just call to the registry
instead of having hardcoded lookups.
s/Transformation/Transform/ with typedefs for compatability.
Remove lib/selftest code (for runtime selftesting): not the right approach.
Diffstat (limited to 'src/lib/block/misty1')
-rw-r--r-- | src/lib/block/misty1/misty1.cpp | 14 | ||||
-rw-r--r-- | src/lib/block/misty1/misty1.h | 8 |
2 files changed, 4 insertions, 18 deletions
diff --git a/src/lib/block/misty1/misty1.cpp b/src/lib/block/misty1/misty1.cpp index d6ffda945..23233e02f 100644 --- a/src/lib/block/misty1/misty1.cpp +++ b/src/lib/block/misty1/misty1.cpp @@ -5,12 +5,14 @@ * Botan is released under the Simplified BSD License (see license.txt) */ +#include <botan/internal/block_utils.h> #include <botan/misty1.h> -#include <botan/loadstor.h> #include <botan/parsing.h> namespace Botan { +BOTAN_REGISTER_BLOCK_CIPHER_NOARGS(MISTY1); + namespace { static const byte MISTY1_SBOX_S7[128] = { @@ -257,14 +259,4 @@ void MISTY1::clear() zap(DK); } -/* -* MISTY1 Constructor -*/ -MISTY1::MISTY1(size_t rounds) - { - if(rounds != 8) - throw Invalid_Argument("MISTY1: Invalid number of rounds: " - + std::to_string(rounds)); - } - } diff --git a/src/lib/block/misty1/misty1.h b/src/lib/block/misty1/misty1.h index 17b617283..177c2c0b5 100644 --- a/src/lib/block/misty1/misty1.h +++ b/src/lib/block/misty1/misty1.h @@ -13,7 +13,7 @@ namespace Botan { /** -* MISTY1 +* MISTY1 with 8 rounds */ class BOTAN_DLL MISTY1 : public Block_Cipher_Fixed_Params<8, 16> { @@ -24,12 +24,6 @@ class BOTAN_DLL MISTY1 : public Block_Cipher_Fixed_Params<8, 16> void clear(); std::string name() const { return "MISTY1"; } BlockCipher* clone() const { return new MISTY1; } - - /** - * @param rounds the number of rounds. Must be 8 with the current - * implementation - */ - MISTY1(size_t rounds = 8); private: void key_schedule(const byte[], size_t); |