aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/compression/comp_util.h
diff options
context:
space:
mode:
authorlloyd <[email protected]>2015-01-28 04:32:10 +0000
committerlloyd <[email protected]>2015-01-28 04:32:10 +0000
commit7b56f1bd570dc684ffd7c945dee0d9b5480354ff (patch)
tree0c50ad534280a292a1b76daee9a19b34cfd96367 /src/lib/compression/comp_util.h
parentb8fa304ec981d273c45d7ef31705d65ccfb00cc1 (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/comp_util.h')
-rw-r--r--src/lib/compression/comp_util.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/lib/compression/comp_util.h b/src/lib/compression/comp_util.h
index 6e1ee1671..963eae642 100644
--- a/src/lib/compression/comp_util.h
+++ b/src/lib/compression/comp_util.h
@@ -9,6 +9,7 @@
#define BOTAN_COMPRESSION_UTILS_H__
#include <botan/compression.h>
+#include <botan/algo_registry.h>
#include <memory>
#include <unordered_map>
@@ -84,6 +85,10 @@ class Zlib_Style_Stream : public Compression_Stream
std::unique_ptr<Compression_Alloc_Info> m_allocs;
};
+#define BOTAN_REGISTER_COMPRESSION(C, D) \
+ BOTAN_REGISTER_T_1LEN(Transform, C, 9) \
+ BOTAN_REGISTER_T_NOARGS(Transform, D)
+
}
#endif