aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/pubkey
diff options
context:
space:
mode:
authorPatrick Wildt <[email protected]>2017-06-28 16:39:29 +0200
committerPatrick Wildt <[email protected]>2017-07-05 11:05:49 +0200
commit92b0ff1faaba7c3fd886e79550bf5fe0fc567e25 (patch)
tree63b93de4f4723bafeee566a3a74a9c5f5b5155ab /src/lib/pubkey
parent783798ca424fe44b36bdec386da91da75e856cdd (diff)
BearSSL: Support for ECDSA
This commit adds support for ECDSA using BearSSL as a backend. This means we can test BearSSL's ECDSA algorithms using the extensive Botan testsuite.
Diffstat (limited to 'src/lib/pubkey')
-rw-r--r--src/lib/pubkey/ecdsa/ecdsa.cpp34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/lib/pubkey/ecdsa/ecdsa.cpp b/src/lib/pubkey/ecdsa/ecdsa.cpp
index bb65fb138..72551c8c7 100644
--- a/src/lib/pubkey/ecdsa/ecdsa.cpp
+++ b/src/lib/pubkey/ecdsa/ecdsa.cpp
@@ -18,6 +18,10 @@
#include <botan/rfc6979.h>
#endif
+#if defined(BOTAN_HAS_BEARSSL)
+ #include <botan/internal/bearssl.h>
+#endif
+
#if defined(BOTAN_HAS_OPENSSL)
#include <botan/internal/openssl.h>
#endif
@@ -156,6 +160,21 @@ std::unique_ptr<PK_Ops::Verification>
ECDSA_PublicKey::create_verification_op(const std::string& params,
const std::string& provider) const
{
+#if defined(BOTAN_HAS_BEARSSL)
+ if(provider == "bearssl" || provider.empty())
+ {
+ try
+ {
+ return make_bearssl_ecdsa_ver_op(*this, params);
+ }
+ catch(Lookup_Error& e)
+ {
+ if(provider == "bearssl")
+ throw;
+ }
+ }
+#endif
+
#if defined(BOTAN_HAS_OPENSSL)
if(provider == "openssl" || provider.empty())
{
@@ -182,6 +201,21 @@ ECDSA_PrivateKey::create_signature_op(RandomNumberGenerator& /*rng*/,
const std::string& params,
const std::string& provider) const
{
+#if defined(BOTAN_HAS_BEARSSL)
+ if(provider == "bearssl" || provider.empty())
+ {
+ try
+ {
+ return make_bearssl_ecdsa_sig_op(*this, params);
+ }
+ catch(Lookup_Error& e)
+ {
+ if(provider == "bearssl")
+ throw;
+ }
+ }
+#endif
+
#if defined(BOTAN_HAS_OPENSSL)
if(provider == "openssl" || provider.empty())
{