• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

randombit / botan / 5079590438

25 May 2023 12:28PM UTC coverage: 92.228% (+0.5%) from 91.723%
5079590438

Pull #3502

github

Pull Request #3502: Apply clang-format to the codebase

75589 of 81959 relevant lines covered (92.23%)

12139530.51 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

92.68
/src/tests/test_gost_3410.cpp
1
/*
2
* (C) 2014,2015 Jack Lloyd
3
*
4
* Botan is released under the Simplified BSD License (see license.txt)
5
*/
6

7
#include "tests.h"
8

9
#if defined(BOTAN_HAS_GOST_34_10_2001)
10
   #include "test_pubkey.h"
11
   #include <botan/gost_3410.h>
12
#endif
13

14
namespace Botan_Tests {
15

16
namespace {
17

18
#if defined(BOTAN_HAS_GOST_34_10_2001)
19

20
class GOST_3410_2001_Verification_Tests final : public PK_Signature_Verification_Test {
×
21
   public:
22
      GOST_3410_2001_Verification_Tests() :
1✔
23
            PK_Signature_Verification_Test("GOST 34.10-2001",
24
                                           "pubkey/gost_3410_verify.vec",
25
                                           "P,A,B,Gx,Gy,Oid,Order,Cofactor,Px,Py,Hash,Msg,Signature") {}
4✔
26

27
      std::unique_ptr<Botan::Public_Key> load_public_key(const VarMap& vars) override {
1✔
28
         const BigInt p = vars.get_req_bn("P");
1✔
29
         const BigInt a = vars.get_req_bn("A");
1✔
30
         const BigInt b = vars.get_req_bn("B");
1✔
31
         const BigInt Gx = vars.get_req_bn("Gx");
1✔
32
         const BigInt Gy = vars.get_req_bn("Gy");
1✔
33
         const BigInt order = vars.get_req_bn("Order");
1✔
34
         const BigInt cofactor = vars.get_req_bn("Cofactor");
1✔
35
         const Botan::OID oid(vars.get_req_str("Oid"));
2✔
36

37
         Botan::EC_Group group(p, a, b, Gx, Gy, order, cofactor, oid);
1✔
38

39
         const BigInt Px = vars.get_req_bn("Px");
1✔
40
         const BigInt Py = vars.get_req_bn("Py");
1✔
41

42
         const Botan::EC_Point public_point = group.point(Px, Py);
1✔
43

44
         return std::make_unique<Botan::GOST_3410_PublicKey>(group, public_point);
2✔
45
      }
10✔
46

47
      std::string default_padding(const VarMap& vars) const override { return vars.get_req_str("Hash"); }
2✔
48
};
49

50
class GOST_3410_2001_Signature_Tests final : public PK_Signature_Generation_Test {
×
51
   public:
52
      GOST_3410_2001_Signature_Tests() :
1✔
53
            PK_Signature_Generation_Test("GOST 34.10-2001",
54
                                         "pubkey/gost_3410_sign.vec",
55
                                         "P,A,B,Gx,Gy,Oid,Order,X,Cofactor,Hash,Nonce,Msg,Signature") {}
4✔
56

57
      std::unique_ptr<Botan::Private_Key> load_private_key(const VarMap& vars) override {
1✔
58
         const BigInt p = vars.get_req_bn("P");
1✔
59
         const BigInt a = vars.get_req_bn("A");
1✔
60
         const BigInt b = vars.get_req_bn("B");
1✔
61
         const BigInt Gx = vars.get_req_bn("Gx");
1✔
62
         const BigInt Gy = vars.get_req_bn("Gy");
1✔
63
         const BigInt order = vars.get_req_bn("Order");
1✔
64
         const BigInt cofactor = vars.get_req_bn("Cofactor");
1✔
65
         const Botan::OID oid(vars.get_req_str("Oid"));
2✔
66

67
         Botan::EC_Group group(p, a, b, Gx, Gy, order, cofactor, oid);
1✔
68

69
         const BigInt x = vars.get_req_bn("X");
1✔
70

71
         return std::make_unique<Botan::GOST_3410_PrivateKey>(Test::rng(), group, x);
2✔
72
      }
8✔
73

74
      std::string default_padding(const VarMap& vars) const override { return vars.get_req_str("Hash"); }
2✔
75

76
      std::unique_ptr<Botan::RandomNumberGenerator> test_rng(const std::vector<uint8_t>& nonce) const override {
1✔
77
         return std::make_unique<Fixed_Output_Position_RNG>(nonce, 1);
1✔
78
      }
79
};
80

81
class GOST_3410_2001_Keygen_Tests final : public PK_Key_Generation_Test {
×
82
   public:
83
      std::vector<std::string> keygen_params() const override { return {"gost_256A", "secp256r1"}; }
3✔
84

85
      std::string algo_name() const override { return "GOST-34.10"; }
6✔
86
};
87

88
BOTAN_REGISTER_TEST("pubkey", "gost_3410_verify", GOST_3410_2001_Verification_Tests);
89
BOTAN_REGISTER_TEST("pubkey", "gost_3410_sign", GOST_3410_2001_Signature_Tests);
90
BOTAN_REGISTER_TEST("pubkey", "gost_3410_keygen", GOST_3410_2001_Keygen_Tests);
91

92
#endif
93

94
}
95

96
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc