aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2016-10-17 06:17:07 -0400
committerJack Lloyd <[email protected]>2016-10-21 16:53:17 -0400
commit51ce4b1ee79aa7be1e72830a729aac8ee9a854d9 (patch)
tree43cd89cbc0704db7bc39055f7096133747ec9a3a /src/lib
parentdf64fb318acbfee7911bee4fd021100f1d6532ed (diff)
Small cleanup in OpenSSL EC
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/prov/openssl/openssl_ec.cpp25
1 files changed, 13 insertions, 12 deletions
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<std::string, int> 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;
}