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

randombit / botan / 5111374265

29 May 2023 11:19AM UTC coverage: 92.227% (+0.5%) from 91.723%
5111374265

push

github

randombit
Next release will be 3.1.0. Update release notes

75588 of 81959 relevant lines covered (92.23%)

11886470.91 hits per line

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

87.5
/src/tests/test_ecgdsa.cpp
1
/*
2
* (C) 2016 René Korthaus, Sirrix AG
3
*
4
* Botan is released under the Simplified BSD License (see license.txt)
5
*/
6

7
#include "tests.h"
8

9
#include "test_rng.h"
10

11
#if defined(BOTAN_HAS_ECGDSA)
12
   #include "test_pubkey.h"
13
   #include <botan/ecgdsa.h>
14
#endif
15

16
namespace Botan_Tests {
17

18
namespace {
19

20
#if defined(BOTAN_HAS_ECGDSA)
21

22
class ECGDSA_Signature_KAT_Tests final : public PK_Signature_Generation_Test {
×
23
   public:
24
      ECGDSA_Signature_KAT_Tests() :
1✔
25
            PK_Signature_Generation_Test("ECGDSA", "pubkey/ecgdsa.vec", "Group,X,Hash,Msg,Nonce,Signature") {}
4✔
26

27
      bool clear_between_callbacks() const override { return false; }
12✔
28

29
      std::unique_ptr<Botan::Private_Key> load_private_key(const VarMap& vars) override {
12✔
30
         const std::string group_id = vars.get_req_str("Group");
12✔
31
         const BigInt x = vars.get_req_bn("X");
12✔
32
         Botan::EC_Group group(Botan::OID::from_string(group_id));
12✔
33

34
         return std::make_unique<Botan::ECGDSA_PrivateKey>(Test::rng(), group, x);
24✔
35
      }
24✔
36

37
      std::string default_padding(const VarMap& vars) const override { return vars.get_req_str("Hash"); }
24✔
38

39
      std::unique_ptr<Botan::RandomNumberGenerator> test_rng(const std::vector<uint8_t>& nonce) const override {
12✔
40
         // ecgdsa signature generation extracts more random than just the nonce,
41
         // but the nonce is extracted first
42
         return std::make_unique<Fixed_Output_Position_RNG>(nonce, 1);
12✔
43
      }
44
};
45

46
class ECGDSA_Keygen_Tests final : public PK_Key_Generation_Test {
×
47
   public:
48
      std::vector<std::string> keygen_params() const override { return {"secp256r1", "secp384r1", "secp521r1"}; }
4✔
49

50
      std::string algo_name() const override { return "ECGDSA"; }
9✔
51
};
52

53
BOTAN_REGISTER_TEST("pubkey", "ecgdsa_sign", ECGDSA_Signature_KAT_Tests);
54
BOTAN_REGISTER_TEST("pubkey", "ecgdsa_keygen", ECGDSA_Keygen_Tests);
55

56
#endif
57

58
}  // namespace
59

60
}  // namespace Botan_Tests
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

© 2025 Coveralls, Inc