diff options
author | lloyd <[email protected]> | 2008-11-12 18:11:50 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2008-11-12 18:11:50 +0000 |
commit | ff1e835d888a2783e59efc30fa125bfaf7d150fe (patch) | |
tree | f69008ec6cfc733bd993a584e7298c1d48afc89d /src/algo_factory/algo_factory.h | |
parent | e99e232ac74cb2761468e2edad4881fc26033df3 (diff) |
Remove support for provider identifiers from SCAN_Name - it turns out this
was not the right place to keep track of this information. Also modify
all Algorithm_Factory constructor functions to take instead of a SCAN_Name
a pair of std::strings - the SCAN name and an optional provider name. If
a provider is specified, either that provider will be used or the request
will fail. Otherwise, the library will attempt best effort, based on
user-set algorithm implementation settings (combine with benchmark.h for
choosing the fastest implementation at runtime) or if not set, a static
ordering (preset in static_provider_weight in prov_weight.cpp, though it
would be nice to make this easier to toggle).
Diffstat (limited to 'src/algo_factory/algo_factory.h')
-rw-r--r-- | src/algo_factory/algo_factory.h | 83 |
1 files changed, 59 insertions, 24 deletions
diff --git a/src/algo_factory/algo_factory.h b/src/algo_factory/algo_factory.h index 07a8c93f1..fbaf26ebf 100644 --- a/src/algo_factory/algo_factory.h +++ b/src/algo_factory/algo_factory.h @@ -7,11 +7,9 @@ #define BOTAN_ALGORITHM_FACTORY_H__ #include <botan/algo_cache.h> -#include <botan/scan_name.h> #include <botan/mutex.h> #include <string> #include <vector> -#include <map> namespace Botan { @@ -29,11 +27,70 @@ class MessageAuthenticationCode; class BOTAN_DLL Algorithm_Factory { public: + /** + * Contructor + * @param mf a mutex factory + */ Algorithm_Factory(Mutex_Factory& mf); + + /** + * Destructor + */ ~Algorithm_Factory(); + /** + * Add an engine implementation to this factory (how steampunk) + */ void add_engine(class Engine*); + /* + * Provider management + */ + std::vector<std::string> providers_of(const std::string& algo_spec); + + void set_preferred_provider(const std::string& algo_spec, + const std::string& provider); + + /* + * Block cipher operations + */ + const BlockCipher* prototype_block_cipher(const std::string& algo_spec, + const std::string& provider = ""); + BlockCipher* make_block_cipher(const std::string& algo_spec, + const std::string& provider = ""); + void add_block_cipher(BlockCipher* hash, const std::string& provider); + + /* + * Stream cipher operations + */ + const StreamCipher* prototype_stream_cipher(const std::string& algo_spec, + const std::string& provider = ""); + StreamCipher* make_stream_cipher(const std::string& algo_spec, + const std::string& provider = ""); + void add_stream_cipher(StreamCipher* hash, const std::string& provider); + + /* + * Hash function operations + */ + const HashFunction* prototype_hash_function(const std::string& algo_spec, + const std::string& provider = ""); + HashFunction* make_hash_function(const std::string& algo_spec, + const std::string& provider = ""); + void add_hash_function(HashFunction* hash, const std::string& provider); + + /* + * MAC operations + */ + const MessageAuthenticationCode* prototype_mac(const std::string& algo_spec, + const std::string& provider = ""); + MessageAuthenticationCode* make_mac(const std::string& algo_spec, + const std::string& provider = ""); + void add_mac(MessageAuthenticationCode* mac, + const std::string& provider); + + /* + * Deprecated + */ class BOTAN_DLL Engine_Iterator { public: @@ -45,28 +102,6 @@ class BOTAN_DLL Algorithm_Factory }; friend class Engine_Iterator; - std::vector<std::string> providers_of(const std::string& algo_spec); - - // 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, const std::string& provider); - - // 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, const std::string& provider); - - // 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, const std::string& provider); - - // MAC operations - const MessageAuthenticationCode* prototype_mac(const SCAN_Name& request); - MessageAuthenticationCode* make_mac(const SCAN_Name& request); - void add_mac(MessageAuthenticationCode* mac, - const std::string& provider); private: class Engine* get_engine_n(u32bit) const; |