From 0dd060fed07b0060f94e3bae62e125a85c1bb877 Mon Sep 17 00:00:00 2001 From: lloyd Date: Wed, 4 Feb 2015 04:03:38 +0000 Subject: Remove algo factory, engines, global RNG, global state, etc. Convert all uses of Algorithm_Factory and the engines to using Algo_Registry The shared pool of entropy sources remains but is moved to EntropySource. With that and few remaining initializations (default OIDs and aliases) moved elsewhere, the global state is empty and init and shutdown are no-ops. Remove almost all of the headers and code for handling the global state, except LibraryInitializer which remains as a compatability stub. Update seeding for blinding so only one hacky almost-global RNG instance needs to be setup instead of across all pubkey uses (it uses either the system RNG or an AutoSeeded_RNG if the system RNG is not available). --- src/lib/modes/mode_utils.h | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'src/lib/modes/mode_utils.h') diff --git a/src/lib/modes/mode_utils.h b/src/lib/modes/mode_utils.h index 70c996428..ef2840000 100644 --- a/src/lib/modes/mode_utils.h +++ b/src/lib/modes/mode_utils.h @@ -9,7 +9,7 @@ #define BOTAN_MODE_UTILS_H__ #include -#include +#include #include #include #include @@ -52,17 +52,17 @@ T* make_block_cipher_mode_len2(const Transform::Spec& spec) return nullptr; } -#define BOTAN_REGISTER_BLOCK_CIPHER_MODE(E, D) \ - namespace { Algo_Registry::Add g_ ## E ## _reg(#E, make_block_cipher_mode); \ - Algo_Registry::Add g_ ## D ## _reg(#D, make_block_cipher_mode); } +#define BOTAN_REGISTER_BLOCK_CIPHER_MODE(E, D) \ + BOTAN_REGISTER_NAMED_T(Transform, #E, E, make_block_cipher_mode); \ + BOTAN_REGISTER_NAMED_T(Transform, #D, D, make_block_cipher_mode); -#define BOTAN_REGISTER_BLOCK_CIPHER_MODE_LEN(E, D, LEN) \ - namespace { Algo_Registry::Add g_ ## E ## _reg(#E, make_block_cipher_mode_len); \ - Algo_Registry::Add g_ ## D ## _reg(#D, make_block_cipher_mode_len); } +#define BOTAN_REGISTER_BLOCK_CIPHER_MODE_LEN(E, D, LEN) \ + BOTAN_REGISTER_NAMED_T(Transform, #E, E, (make_block_cipher_mode_len)); \ + BOTAN_REGISTER_NAMED_T(Transform, #D, D, (make_block_cipher_mode_len)); -#define BOTAN_REGISTER_BLOCK_CIPHER_MODE_LEN2(E, D, LEN1, LEN2) \ - namespace { Algo_Registry::Add g_ ## E ## _reg(#E, make_block_cipher_mode_len2); \ - Algo_Registry::Add g_ ## D ## _reg(#D, make_block_cipher_mode_len2); } +#define BOTAN_REGISTER_BLOCK_CIPHER_MODE_LEN2(E, D, LEN1, LEN2) \ + BOTAN_REGISTER_NAMED_T(Transform, #E, E, (make_block_cipher_mode_len2)); \ + BOTAN_REGISTER_NAMED_T(Transform, #D, D, (make_block_cipher_mode_len2)); } -- cgit v1.2.3