aboutsummaryrefslogtreecommitdiffstats
path: root/src/tests/test_dsa.cpp
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2018-03-21 03:31:08 -0400
committerJack Lloyd <[email protected]>2018-03-21 03:40:12 -0400
commit6868990a0c854c33bc2daf0edd4135eab7fedc34 (patch)
tree2090f0fc8cc2e0e67d16f035ef86dee40f497586 /src/tests/test_dsa.cpp
parentad66550111bac3f64fdf3eef4c630a9eb09be321 (diff)
Change DSA behavior similarly
Diffstat (limited to 'src/tests/test_dsa.cpp')
-rw-r--r--src/tests/test_dsa.cpp33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/tests/test_dsa.cpp b/src/tests/test_dsa.cpp
index b76c78a58..c0b2508c0 100644
--- a/src/tests/test_dsa.cpp
+++ b/src/tests/test_dsa.cpp
@@ -55,6 +55,38 @@ class DSA_KAT_Tests final : public PK_Signature_Generation_Test
}
};
+class DSA_Verification_Tests final : public PK_Signature_Verification_Test
+ {
+ public:
+ DSA_Verification_Tests() : PK_Signature_Verification_Test(
+ "DSA",
+ "pubkey/dsa_verify.vec",
+ "P,Q,G,Y,Msg,Signature") {}
+
+ bool clear_between_callbacks() const override
+ {
+ return false;
+ }
+
+ std::unique_ptr<Botan::Public_Key> load_public_key(const VarMap& vars) override
+ {
+ const Botan::BigInt p = get_req_bn(vars, "P");
+ const Botan::BigInt q = get_req_bn(vars, "Q");
+ const Botan::BigInt g = get_req_bn(vars, "G");
+ const Botan::BigInt y = get_req_bn(vars, "Y");
+
+ const Botan::DL_Group grp(p, q, g);
+
+ std::unique_ptr<Botan::Public_Key> key(new Botan::DSA_PublicKey(grp, y));
+ return key;
+ }
+
+ std::string default_padding(const VarMap&) const override
+ {
+ return "Raw";
+ }
+ };
+
class DSA_Keygen_Tests final : public PK_Key_Generation_Test
{
public:
@@ -69,6 +101,7 @@ class DSA_Keygen_Tests final : public PK_Key_Generation_Test
};
BOTAN_REGISTER_TEST("dsa_sign", DSA_KAT_Tests);
+BOTAN_REGISTER_TEST("dsa_verify", DSA_Verification_Tests);
BOTAN_REGISTER_TEST("dsa_keygen", DSA_Keygen_Tests);
#endif