diff options
author | lloyd <[email protected]> | 2008-11-10 20:14:38 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2008-11-10 20:14:38 +0000 |
commit | 9d529fb82a301f14b9cb0efb6c69c1fdb9c984e2 (patch) | |
tree | e9e6b69cfd6ef13e3554b638206d7faa1d6a55a3 /src/libstate | |
parent | 148c4ecbd4116f9420229853b567cc17310b1cd1 (diff) |
Have Algorithm_Factory::make_hash_function throw an exception if it can't
find an object to clone.
Add a new constructor to Hash_Filter taking a HashFunction*
Diffstat (limited to 'src/libstate')
-rw-r--r-- | src/libstate/algo_factory.cpp | 4 | ||||
-rw-r--r-- | src/libstate/lookup.cpp | 8 |
2 files changed, 4 insertions, 8 deletions
diff --git a/src/libstate/algo_factory.cpp b/src/libstate/algo_factory.cpp index c7f10a68a..cbb3c8faa 100644 --- a/src/libstate/algo_factory.cpp +++ b/src/libstate/algo_factory.cpp @@ -6,6 +6,7 @@ Algorithm Factory #include <botan/libstate.h> #include <botan/stl_util.h> #include <botan/engine.h> +#include <botan/exceptn.h> #include <algorithm> namespace Botan { @@ -66,7 +67,8 @@ HashFunction* Algorithm_Factory::make_hash_function(const SCAN_Name& request) const HashFunction* prototype = prototype_hash_function(request); if(prototype) return prototype->clone(); - return 0; + + throw Algorithm_Not_Found(request.as_string()); } } diff --git a/src/libstate/lookup.cpp b/src/libstate/lookup.cpp index d8fab625b..52e986ff2 100644 --- a/src/libstate/lookup.cpp +++ b/src/libstate/lookup.cpp @@ -23,13 +23,7 @@ const HashFunction* retrieve_hash(Library_State& libstate, *************************************************/ HashFunction* get_hash(const std::string& algo_spec) { - const HashFunction* hash = - global_state().algo_factory().prototype_hash_function(algo_spec); - - if(hash) - return hash->clone(); - - throw Algorithm_Not_Found(algo_spec); + return global_state().algo_factory().make_hash_function(algo_spec); } /************************************************* |