From 26f31c652fc1c25f3349530c7bf8ee0eb999e469 Mon Sep 17 00:00:00 2001 From: Jack Lloyd Date: Thu, 31 May 2018 17:34:47 -0400 Subject: Handle EC_R_BAD_SIGNATURE from OpenSSL --- src/lib/prov/openssl/openssl_ec.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) (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 c61f83d02..ca5be857a 100644 --- a/src/lib/prov/openssl/openssl_ec.cpp +++ b/src/lib/prov/openssl/openssl_ec.cpp @@ -185,7 +185,18 @@ class OpenSSL_ECDSA_Verification_Operation final : public PK_Ops::Verification_w const int res = ECDSA_do_verify(msg, msg_len, sig.get(), m_ossl_ec.get()); if(res < 0) + { + int err = ERR_get_error(); +#if defined(EC_R_BAD_SIGNATURE) + if(ERR_GET_REASON(err) != EC_R_BAD_SIGNATURE) + throw OpenSSL_Error("ECDSA_do_verify", err); +#elif defined(ECDSA_R_BAD_SIGNATURE) + if(ERR_GET_REASON(err) != ECDSA_R_BAD_SIGNATURE) + throw OpenSSL_Error("ECDSA_do_verify", err); +#else throw OpenSSL_Error("ECDSA_do_verify"); +#endif + } return (res == 1); } -- cgit v1.2.3