diff options
author | Jack Lloyd <[email protected]> | 2018-03-21 03:31:08 -0400 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2018-03-21 03:40:12 -0400 |
commit | 6868990a0c854c33bc2daf0edd4135eab7fedc34 (patch) | |
tree | 2090f0fc8cc2e0e67d16f035ef86dee40f497586 /src/tests/test_dsa.cpp | |
parent | ad66550111bac3f64fdf3eef4c630a9eb09be321 (diff) |
Change DSA behavior similarly
Diffstat (limited to 'src/tests/test_dsa.cpp')
-rw-r--r-- | src/tests/test_dsa.cpp | 33 |
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 |