From 2fe47f9071f37591a2016c16bb9b04f8e191e1c8 Mon Sep 17 00:00:00 2001 From: lloyd Date: Mon, 10 Nov 2008 20:51:46 +0000 Subject: Move add_algorithm for hashes also to Algorithm_Factory --- src/libstate/lookup.cpp | 27 ++++++++------------------- 1 file changed, 8 insertions(+), 19 deletions(-) (limited to 'src/libstate/lookup.cpp') diff --git a/src/libstate/lookup.cpp b/src/libstate/lookup.cpp index 52e986ff2..f53b1a099 100644 --- a/src/libstate/lookup.cpp +++ b/src/libstate/lookup.cpp @@ -26,6 +26,14 @@ HashFunction* get_hash(const std::string& algo_spec) return global_state().algo_factory().make_hash_function(algo_spec); } +/************************************************* +* Add a new hash function * +*************************************************/ +void add_algorithm(Library_State& libstate, HashFunction* algo) + { + libstate.algo_factory().add_hash_function(algo); + } + /************************************************* * Query if Botan has the named hash function * *************************************************/ @@ -311,25 +319,6 @@ void add_algorithm(Library_State& libstate, StreamCipher* algo) throw Invalid_State("add_algorithm: Couldn't find the Default_Engine"); } -/************************************************* -* Add a new hash function * -*************************************************/ -void add_algorithm(Library_State& libstate, HashFunction* algo) - { - Algorithm_Factory::Engine_Iterator i(libstate.algo_factory()); - - while(Engine* engine = i.next()) - { - if(engine->can_add_algorithms()) - { - engine->add_algorithm(algo); - return; - } - } - - throw Invalid_State("add_algorithm: Couldn't find the Default_Engine"); - } - /************************************************* * Add a new authentication code * *************************************************/ -- cgit v1.2.3