From e2d4cb5a9cd046453e79589d6c182bc23975ae4b Mon Sep 17 00:00:00 2001 From: lloyd Date: Tue, 11 Nov 2008 01:20:07 +0000 Subject: Move Algorithm_Factory from libstate (which it did not depend on) to algo_factory/ --- src/algo_factory/algo_factory.h | 70 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 src/algo_factory/algo_factory.h (limited to 'src/algo_factory/algo_factory.h') diff --git a/src/algo_factory/algo_factory.h b/src/algo_factory/algo_factory.h new file mode 100644 index 000000000..2513c42c9 --- /dev/null +++ b/src/algo_factory/algo_factory.h @@ -0,0 +1,70 @@ +/** +* Algorithm Factory +* (C) 2008 Jack Lloyd +*/ + +#ifndef BOTAN_ALGORITHM_FACTORY_H__ +#define BOTAN_ALGORITHM_FACTORY_H__ + +#include +#include +#include +#include + +namespace Botan { + +class BlockCipher; +class StreamCipher; +class HashFunction; +class MessageAuthenticationCode; + +/** +* Algorithm Factory +*/ +class BOTAN_DLL Algorithm_Factory + { + public: + ~Algorithm_Factory(); + + void add_engine(class Engine*); + + class BOTAN_DLL Engine_Iterator + { + public: + class Engine* next() { return af.get_engine_n(n++); } + Engine_Iterator(const Algorithm_Factory& a) : af(a) { n = 0; } + private: + const Algorithm_Factory& af; + u32bit n; + }; + friend class Engine_Iterator; + + // Block cipher operations + const BlockCipher* prototype_block_cipher(const SCAN_Name& request); + BlockCipher* make_block_cipher(const SCAN_Name& request); + void add_block_cipher(BlockCipher* hash); + + // Stream cipher operations + const StreamCipher* prototype_stream_cipher(const SCAN_Name& request); + StreamCipher* make_stream_cipher(const SCAN_Name& request); + void add_stream_cipher(StreamCipher* hash); + + // Hash function operations + const HashFunction* prototype_hash_function(const SCAN_Name& request); + HashFunction* make_hash_function(const SCAN_Name& request); + void add_hash_function(HashFunction* hash); + + // MAC operations + const MessageAuthenticationCode* prototype_mac(const SCAN_Name& request); + MessageAuthenticationCode* make_mac(const SCAN_Name& request); + void add_mac(MessageAuthenticationCode* mac); + + private: + class Engine* get_engine_n(u32bit) const; + + std::vector engines; + }; + +} + +#endif -- cgit v1.2.3