aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/tests/data/pubkey/gost_3410_sign.vec17
-rw-r--r--src/tests/data/pubkey/gost_3410_verify.vec (renamed from src/tests/data/pubkey/gost_3410.vec)0
-rw-r--r--src/tests/test_gost_3410.cpp33
3 files changed, 49 insertions, 1 deletions
diff --git a/src/tests/data/pubkey/gost_3410_sign.vec b/src/tests/data/pubkey/gost_3410_sign.vec
new file mode 100644
index 000000000..25d5155b7
--- /dev/null
+++ b/src/tests/data/pubkey/gost_3410_sign.vec
@@ -0,0 +1,17 @@
+
+# These values were generated by Botan and have not been tested against any
+# other implementation.
+
+Group = gost_256A
+Privkey = 0xFE406F383A54127453AED406FA9A3B610B28F89FC918C07A5A75289E97B3A991
+Hash = GOST-34.11
+Msg = ABCD
+Nonce = 3E0A6097034780CCF32885B870F84B0AA20138BE94A1AA1F77F8997CAC25C58E
+Signature = 60053488E6936975A4913083FE16A0CF620FA75732B563AB65B82D37A825BE7D0965C38281A01D23FA5F5D332B339EB2602A564563C005335269A2E811520563
+
+Group = gost_256A
+Privkey = 0xFDCE35FFFF3AEF1C3AB247F31D733490B4029E699FC2D1C24B2F7C526CBC1445
+Hash = GOST-34.11
+Msg = 33C466741BB472998A27E26E7F77EBF3
+Nonce = 6844F464FA0147FB7D798137680FBA6EA2E709814E3A8B70EFC26F446DE9F94B
+Signature = 5E39519E12B5208B3A0A1A1CDD44E2629F0F76A51DFED8484A8B67A2E46D5B871AFADA58E26D1FE08AB4D2E67BF0FF8508870B417D6EA1224FA98B3165D8A032
diff --git a/src/tests/data/pubkey/gost_3410.vec b/src/tests/data/pubkey/gost_3410_verify.vec
index 5348467a6..5348467a6 100644
--- a/src/tests/data/pubkey/gost_3410.vec
+++ b/src/tests/data/pubkey/gost_3410_verify.vec
diff --git a/src/tests/test_gost_3410.cpp b/src/tests/test_gost_3410.cpp
index dffe53d46..70eb28870 100644
--- a/src/tests/test_gost_3410.cpp
+++ b/src/tests/test_gost_3410.cpp
@@ -23,7 +23,7 @@ class GOST_3410_2001_Verification_Tests : public PK_Signature_Verification_Test
public:
GOST_3410_2001_Verification_Tests() : PK_Signature_Verification_Test(
"GOST 34.10-2001",
- "pubkey/gost_3410.vec",
+ "pubkey/gost_3410_verify.vec",
{"Group", "Pubkey", "Hash", "Msg", "Signature"})
{}
@@ -43,6 +43,36 @@ class GOST_3410_2001_Verification_Tests : public PK_Signature_Verification_Test
}
};
+class GOST_3410_2001_Signature_Tests : public PK_Signature_Generation_Test
+ {
+ public:
+ GOST_3410_2001_Signature_Tests() : PK_Signature_Generation_Test(
+ "GOST 34.10-2001",
+ "pubkey/gost_3410_sign.vec",
+ {"Group", "Privkey", "Hash", "Nonce", "Msg", "Signature"}, {})
+ {}
+
+ std::unique_ptr<Botan::Private_Key> load_private_key(const VarMap& vars) override
+ {
+ const std::string group_id = get_req_str(vars, "Group");
+ const BigInt x = get_req_bn(vars, "Privkey");
+ Botan::EC_Group group(Botan::OIDS::lookup(group_id));
+
+ std::unique_ptr<Botan::Private_Key> key(new Botan::GOST_3410_PrivateKey(Test::rng(), group, x));
+ return key;
+ }
+
+ std::string default_padding(const VarMap& vars) const override
+ {
+ return "EMSA1(" + get_req_str(vars, "Hash") + ")";
+ }
+
+ Botan::RandomNumberGenerator* test_rng(const std::vector<uint8_t>& nonce) const override
+ {
+ return new Fixed_Output_Position_RNG(nonce, 1);
+ }
+ };
+
class GOST_3410_2001_Keygen_Tests : public PK_Key_Generation_Test
{
public:
@@ -51,6 +81,7 @@ class GOST_3410_2001_Keygen_Tests : public PK_Key_Generation_Test
};
BOTAN_REGISTER_TEST("gost_3410_verify", GOST_3410_2001_Verification_Tests);
+BOTAN_REGISTER_TEST("gost_3410_sign", GOST_3410_2001_Signature_Tests);
BOTAN_REGISTER_TEST("gost_3410_keygen", GOST_3410_2001_Keygen_Tests);
#endif