diff options
Diffstat (limited to 'src/lib/base/scan_name.cpp')
-rw-r--r-- | src/lib/base/scan_name.cpp | 56 |
1 files changed, 2 insertions, 54 deletions
diff --git a/src/lib/base/scan_name.cpp b/src/lib/base/scan_name.cpp index 76d9b1a17..d18296a78 100644 --- a/src/lib/base/scan_name.cpp +++ b/src/lib/base/scan_name.cpp @@ -52,13 +52,6 @@ std::string make_arg( return output; } -std::pair<size_t, std::string> -deref_aliases(const std::pair<size_t, std::string>& in) - { - return std::make_pair(in.first, - SCAN_Name::deref_alias(in.second)); - } - } SCAN_Name::SCAN_Name(std::string algo_spec, const std::string& extra) : SCAN_Name(algo_spec) @@ -78,8 +71,6 @@ SCAN_Name::SCAN_Name(std::string algo_spec) : m_orig_algo_spec(algo_spec), m_alg const std::string decoding_error = "Bad SCAN name '" + algo_spec + "': "; - algo_spec = SCAN_Name::deref_alias(algo_spec); - for(size_t i = 0; i != algo_spec.size(); ++i) { char c = algo_spec[i]; @@ -100,7 +91,7 @@ SCAN_Name::SCAN_Name(std::string algo_spec) : m_orig_algo_spec(algo_spec), m_alg else { if(accum.second != "") - name.push_back(deref_aliases(accum)); + name.push_back(accum); accum = std::make_pair(level, ""); } } @@ -109,7 +100,7 @@ SCAN_Name::SCAN_Name(std::string algo_spec) : m_orig_algo_spec(algo_spec), m_alg } if(accum.second != "") - name.push_back(deref_aliases(accum)); + name.push_back(accum); if(level != 0) throw Decoding_Error(decoding_error + "Missing close paren"); @@ -172,47 +163,4 @@ size_t SCAN_Name::arg_as_integer(size_t i, size_t def_value) const return to_u32bit(m_args[i]); } -mutex_type SCAN_Name::g_alias_map_mutex; -std::map<std::string, std::string> SCAN_Name::g_alias_map = { - { "3DES", "TripleDES" }, - { "ARC4", "RC4" }, - { "CAST5", "CAST-128" }, - { "DES-EDE", "TripleDES" }, - { "EME-OAEP", "OAEP" }, - { "EME-PKCS1-v1_5", "PKCS1v15" }, - { "EME1", "OAEP" }, - { "EMSA-PKCS1-v1_5", "EMSA_PKCS1" }, - { "EMSA-PSS", "PSSR" }, - { "EMSA2", "EMSA_X931" }, - { "EMSA3", "EMSA_PKCS1" }, - { "EMSA4", "PSSR" }, - { "GOST-34.11", "GOST-R-34.11-94" }, - { "MARK-4", "RC4(256)" }, - { "OMAC", "CMAC" }, - { "PSS-MGF1", "PSSR" }, - { "SHA-1", "SHA-160" }, - { "SHA1", "SHA-160" }, - { "X9.31", "EMSA2" } -}; - -void SCAN_Name::add_alias(const std::string& alias, const std::string& basename) - { - lock_guard_type<mutex_type> lock(g_alias_map_mutex); - - if(g_alias_map.find(alias) == g_alias_map.end()) - g_alias_map[alias] = basename; - } - -std::string SCAN_Name::deref_alias(const std::string& alias) - { - lock_guard_type<mutex_type> lock(g_alias_map_mutex); - - std::string name = alias; - - for(auto i = g_alias_map.find(name); i != g_alias_map.end(); i = g_alias_map.find(name)) - name = i->second; - - return name; - } - } |