aboutsummaryrefslogtreecommitdiffstats
path: root/src/utils/scan_name.cpp
diff options
context:
space:
mode:
authorlloyd <[email protected]>2008-11-10 04:25:52 +0000
committerlloyd <[email protected]>2008-11-10 04:25:52 +0000
commit91a7af626430335b64616df486f0fe49cd745660 (patch)
tree1978d31a248546a1f70b0707a24ab55e17a52aad /src/utils/scan_name.cpp
parent5bd2c0bdd8d805adaa081228932edbd6dd6c1708 (diff)
Add a facility in SCAN_Name for provider names
Diffstat (limited to 'src/utils/scan_name.cpp')
-rw-r--r--src/utils/scan_name.cpp26
1 files changed, 24 insertions, 2 deletions
diff --git a/src/utils/scan_name.cpp b/src/utils/scan_name.cpp
index 91d017811..77e15fa07 100644
--- a/src/utils/scan_name.cpp
+++ b/src/utils/scan_name.cpp
@@ -10,12 +10,34 @@ SCAN Name Abstraction
namespace Botan {
-SCAN_Name::SCAN_Name(const std::string& algo_spec)
+SCAN_Name::SCAN_Name(const std::string& algo_spec,
+ const std::string& prov_names)
{
name = parse_algorithm_name(algo_spec);
-
for(u32bit i = 0; i != name.size(); ++i)
name[i] = global_state().deref_alias(name[i]);
+
+ if(prov_names.find(',') != std::string::npos)
+ {
+ std::vector<std::string> prov_names_vec = split_on(prov_names, ',');
+ for(u32bit i = 0; i != prov_names_vec.size(); ++i)
+ providers.insert(prov_names_vec[i]);
+ }
+ else if(prov_names != "")
+ providers.insert(prov_names);
+ }
+
+bool SCAN_Name::provider_allowed(const std::string& provider) const
+ {
+ // If not providers were specified by the user, then allow any;
+ // usually the source order will try to perfer one of the better
+ // ones first.
+
+ // The core provider is always enabled
+ if(provider == "core" || providers.empty())
+ return true;
+
+ return (providers.find(provider) != providers.end());
}
std::string SCAN_Name::argument(u32bit i) const