diff options
author | lloyd <[email protected]> | 2008-11-11 01:35:42 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2008-11-11 01:35:42 +0000 |
commit | 3dbf2df27a12fd3daf8f42d58659f327fbd5609c (patch) | |
tree | 2db7515a974838914ef6f8933d359dadbaf76d6c | |
parent | d1829bc441f8a096eddbdd0a1536682e0ab07c3e (diff) |
Add a function to query algorithm providers
-rw-r--r-- | src/algo_factory/algo_factory.cpp | 25 | ||||
-rw-r--r-- | src/algo_factory/algo_factory.h | 2 |
2 files changed, 27 insertions, 0 deletions
diff --git a/src/algo_factory/algo_factory.cpp b/src/algo_factory/algo_factory.cpp index cdef6351f..2f7921ce0 100644 --- a/src/algo_factory/algo_factory.cpp +++ b/src/algo_factory/algo_factory.cpp @@ -45,6 +45,31 @@ Engine* Algorithm_Factory::get_engine_n(u32bit n) const } /** +* Return the possible providers of a request +*/ +std::vector<std::string> +Algorithm_Factory::providers_of(const SCAN_Name& request) + { + std::vector<std::string> providers; + for(u32bit i = 0; i != engines.size(); ++i) + { + std::string provider = engines[i]->provider_name(); + if(request.provider_allowed(provider)) + { + if(engines[i]->prototype_block_cipher(request, *this) || + engines[i]->prototype_stream_cipher(request, *this) || + engines[i]->prototype_hash_function(request, *this) || + engines[i]->prototype_mac(request, *this)) + { + providers.push_back(provider); + } + } + } + + return providers; + } + +/** * Return the prototypical object cooresponding to this request */ const BlockCipher* diff --git a/src/algo_factory/algo_factory.h b/src/algo_factory/algo_factory.h index 2513c42c9..fb41b4882 100644 --- a/src/algo_factory/algo_factory.h +++ b/src/algo_factory/algo_factory.h @@ -39,6 +39,8 @@ class BOTAN_DLL Algorithm_Factory }; friend class Engine_Iterator; + std::vector<std::string> providers_of(const SCAN_Name& request); + // Block cipher operations const BlockCipher* prototype_block_cipher(const SCAN_Name& request); BlockCipher* make_block_cipher(const SCAN_Name& request); |