From c243688f6062cf4577610d8ef71ba0ec60a932e2 Mon Sep 17 00:00:00 2001 From: lloyd Date: Sun, 23 Nov 2008 21:17:20 +0000 Subject: Add an Algorithm_Factory& argument to Engine::get_cipher to avoid a dependency on libstate.h --- src/engine/def_engine/def_eng.h | 4 +++- src/engine/def_engine/def_mode.cpp | 7 +++---- 2 files changed, 6 insertions(+), 5 deletions(-) (limited to 'src/engine/def_engine') diff --git a/src/engine/def_engine/def_eng.h b/src/engine/def_engine/def_eng.h index 0c95c08c5..0cdf7ffb4 100644 --- a/src/engine/def_engine/def_eng.h +++ b/src/engine/def_engine/def_eng.h @@ -59,7 +59,9 @@ class BOTAN_DLL Default_Engine : public Engine virtual bool can_add_algorithms() { return true; } - Keyed_Filter* get_cipher(const std::string&, Cipher_Dir); + Keyed_Filter* get_cipher(const std::string&, Cipher_Dir, + Algorithm_Factory&); + private: BlockCipher* find_block_cipher(const SCAN_Name&, Algorithm_Factory&) const; diff --git a/src/engine/def_engine/def_mode.cpp b/src/engine/def_engine/def_mode.cpp index a2015e6d3..a2594c13f 100644 --- a/src/engine/def_engine/def_mode.cpp +++ b/src/engine/def_engine/def_mode.cpp @@ -6,7 +6,7 @@ #include #include #include -#include +#include #include #include @@ -72,7 +72,8 @@ BlockCipherModePaddingMethod* get_bc_pad(const std::string& algo_spec) * Get a cipher object * *************************************************/ Keyed_Filter* Default_Engine::get_cipher(const std::string& algo_spec, - Cipher_Dir direction) + Cipher_Dir direction, + Algorithm_Factory& af) { std::vector algo_parts = split_on(algo_spec, '/'); if(algo_parts.empty()) @@ -80,8 +81,6 @@ Keyed_Filter* Default_Engine::get_cipher(const std::string& algo_spec, const std::string cipher_name = algo_parts[0]; - Algorithm_Factory& af = global_state().algorithm_factory(); - // check if it is a stream cipher first (easy case) const StreamCipher* stream_cipher = af.prototype_stream_cipher(cipher_name); if(stream_cipher) -- cgit v1.2.3