aboutsummaryrefslogtreecommitdiffstats
path: root/src/tests/test_ecdsa.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/tests/test_ecdsa.cpp')
-rw-r--r--src/tests/test_ecdsa.cpp20
1 files changed, 18 insertions, 2 deletions
diff --git a/src/tests/test_ecdsa.cpp b/src/tests/test_ecdsa.cpp
index 7140dcbe7..be56c315e 100644
--- a/src/tests/test_ecdsa.cpp
+++ b/src/tests/test_ecdsa.cpp
@@ -6,6 +6,8 @@
#include "tests.h"
+#include "test_rng.h"
+
#if defined(BOTAN_HAS_ECDSA)
#include "test_pubkey.h"
#include <botan/ecdsa.h>
@@ -23,8 +25,13 @@ class ECDSA_Signature_KAT_Tests : public PK_Signature_Generation_Test
public:
ECDSA_Signature_KAT_Tests() : PK_Signature_Generation_Test(
"ECDSA",
- "pubkey/ecdsa.vec",
+#if defined(BOTAN_HAS_RFC6979_GENERATOR)
+ "pubkey/ecdsa_rfc6979.vec",
{"Group", "X", "Hash", "Msg", "Signature"})
+#else
+ "pubkey/ecdsa_prob.vec",
+ {"Group", "X", "Hash", "Msg", "Nonce", "Signature"})
+#endif
{}
bool clear_between_callbacks() const override { return false; }
@@ -43,12 +50,21 @@ class ECDSA_Signature_KAT_Tests : public PK_Signature_Generation_Test
{
return "EMSA1(" + get_req_str(vars, "Hash") + ")";
}
+
+#if !defined(BOTAN_HAS_RFC6979)
+ Botan::RandomNumberGenerator* test_rng(const std::vector<uint8_t>& nonce) const override
+ {
+ // probabilistic ecdsa signature generation extracts more random than just the nonce,
+ // but the nonce is extracted first
+ return new Fixed_Output_Position_RNG(nonce, 1);
+ }
+#endif
};
class ECDSA_Keygen_Tests : public PK_Key_Generation_Test
{
public:
- std::vector<std::string> keygen_params() const override { return { "secp256r1", "secp384r1", "secp521r1" }; }
+ std::vector<std::string> keygen_params() const override { return { "secp256r1", "secp384r1", "secp521r1", "frp256v1" }; }
std::unique_ptr<Botan::Private_Key> make_key(Botan::RandomNumberGenerator& rng,
const std::string& param) const override