• 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

86.67
/src/tests/test_eckcdsa.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_ECKCDSA)
12
   #include "test_pubkey.h"
13
   #include <botan/eckcdsa.h>
14
#endif
15

16
namespace Botan_Tests {
17

18
namespace {
19

20
#if defined(BOTAN_HAS_ECKCDSA)
21

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

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

32
         return std::make_unique<Botan::ECKCDSA_PrivateKey>(Test::rng(), group, x);
22✔
33
      }
22✔
34

35
      std::string default_padding(const VarMap& vars) const override { return vars.get_req_str("Hash"); }
22✔
36

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

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

48
      std::string algo_name() const override { return "ECKCDSA"; }
9✔
49
};
50

51
BOTAN_REGISTER_TEST("pubkey", "eckcdsa_sign", ECKCDSA_Signature_KAT_Tests);
52
BOTAN_REGISTER_TEST("pubkey", "eckcdsa_keygen", ECKCDSA_Keygen_Tests);
53

54
#endif
55

56
}
57

58
}
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