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/compression/compression.h | |
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/compression/compression.h')
-rw-r--r-- | src/lib/compression/compression.h | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/lib/compression/compression.h b/src/lib/compression/compression.h index b38d94f64..f70252cbe 100644 --- a/src/lib/compression/compression.h +++ b/src/lib/compression/compression.h @@ -12,7 +12,7 @@ namespace Botan { -class BOTAN_DLL Compressor_Transformation : public Transformation +class BOTAN_DLL Compressor_Transform : public Transform { public: size_t update_granularity() const override { return 1; } @@ -32,8 +32,8 @@ class BOTAN_DLL Compressor_Transformation : public Transformation } }; -BOTAN_DLL Compressor_Transformation* make_compressor(const std::string& type, size_t level); -BOTAN_DLL Compressor_Transformation* make_decompressor(const std::string& type); +BOTAN_DLL Transform* make_compressor(const std::string& type, size_t level); +BOTAN_DLL Transform* make_decompressor(const std::string& type); class Compression_Stream { @@ -55,7 +55,7 @@ class Compression_Stream virtual bool run(u32bit flags) = 0; }; -class BOTAN_DLL Stream_Compression : public Compressor_Transformation +class BOTAN_DLL Stream_Compression : public Compressor_Transform { public: void update(secure_vector<byte>& buf, size_t offset = 0) override; @@ -76,7 +76,7 @@ class BOTAN_DLL Stream_Compression : public Compressor_Transformation std::unique_ptr<Compression_Stream> m_stream; }; -class BOTAN_DLL Stream_Decompression : public Compressor_Transformation +class BOTAN_DLL Stream_Decompression : public Compressor_Transform { public: void update(secure_vector<byte>& buf, size_t offset = 0) override; |