From 51ce4b1ee79aa7be1e72830a729aac8ee9a854d9 Mon Sep 17 00:00:00 2001 From: Jack Lloyd Date: Mon, 17 Oct 2016 06:17:07 -0400 Subject: Small cleanup in OpenSSL EC --- src/lib/prov/openssl/openssl_ec.cpp | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) (limited to 'src/lib/prov/openssl/openssl_ec.cpp') diff --git a/src/lib/prov/openssl/openssl_ec.cpp b/src/lib/prov/openssl/openssl_ec.cpp index aee31ce71..7b20b1c73 100644 --- a/src/lib/prov/openssl/openssl_ec.cpp +++ b/src/lib/prov/openssl/openssl_ec.cpp @@ -67,19 +67,20 @@ int OpenSSL_EC_nid_for(const OID& oid) if(oid.empty()) return -1; - static const std::map nid_map = { - { "secp192r1", NID_X9_62_prime192v1 }, - { "secp224r1", NID_secp224r1 }, - { "secp256r1", NID_X9_62_prime256v1 }, - { "secp384r1", NID_secp384r1 }, - { "secp521r1", NID_secp521r1 }, - // TODO: OpenSSL 1.0.2 added brainpool curves - }; - const std::string name = OIDS::lookup(oid); - auto i = nid_map.find(name); - if(i != nid_map.end()) - return i->second; + + if(name == "secp192r1") + return NID_X9_62_prime192v1; + if(name == "secp224r1") + return NID_secp224r1; + if(name == "secp256r1") + return NID_X9_62_prime256v1; + if(name == "secp384r1") + return NID_secp384r1; + if(name == "secp521r1") + return NID_secp521r1; + + // TODO: OpenSSL 1.0.2 added brainpool curves return -1; } -- cgit v1.2.3