diff options
author | Jack Lloyd <[email protected]> | 2016-10-09 07:46:36 -0400 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2016-10-09 07:46:36 -0400 |
commit | 27a6d112f00f7bb27aba2049068930735d737737 (patch) | |
tree | fdb57864443025a0c3de9b567df134f57beafceb | |
parent | 55b8fb5a33f1ec8a337623788ab84810527089db (diff) |
The other half of 55b8fb5
GH #656
-rw-r--r-- | src/lib/prov/openssl/openssl_ec.cpp | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/src/lib/prov/openssl/openssl_ec.cpp b/src/lib/prov/openssl/openssl_ec.cpp index e127d749b..aee31ce71 100644 --- a/src/lib/prov/openssl/openssl_ec.cpp +++ b/src/lib/prov/openssl/openssl_ec.cpp @@ -191,20 +191,22 @@ std::unique_ptr<PK_Ops::Verification> make_openssl_ecdsa_ver_op(const ECDSA_PublicKey& key, const std::string& params) { const int nid = OpenSSL_EC_nid_for(key.domain().get_oid()); - if(nid > 0) + if(nid < 0) { - return std::unique_ptr<PK_Ops::Verification>(new OpenSSL_ECDSA_Verification_Operation(key, params, nid)); + throw Lookup_Error("OpenSSL ECDSA does not support this curve"); } - return {}; + return std::unique_ptr<PK_Ops::Verification>(new OpenSSL_ECDSA_Verification_Operation(key, params, nid)); } std::unique_ptr<PK_Ops::Signature> make_openssl_ecdsa_sig_op(const ECDSA_PrivateKey& key, const std::string& params) { const int nid = OpenSSL_EC_nid_for(key.domain().get_oid()); - if(nid > 0) - return std::unique_ptr<PK_Ops::Signature>(new OpenSSL_ECDSA_Signing_Operation(key, params)); - return {}; + if(nid < 0) + { + throw Lookup_Error("OpenSSL ECDSA does not support this curve"); + } + return std::unique_ptr<PK_Ops::Signature>(new OpenSSL_ECDSA_Signing_Operation(key, params)); } #endif @@ -273,7 +275,7 @@ std::unique_ptr<PK_Ops::Key_Agreement> make_openssl_ecdh_ka_op(const ECDH_PrivateKey& key, const std::string& params) { const int nid = OpenSSL_EC_nid_for(key.domain().get_oid()); - if(nid == 0) + if(nid < 0) { throw Lookup_Error("OpenSSL ECDH does not support this curve"); } |