• 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

85.71
/src/tests/test_workfactor.cpp
1
/*
2
* (C) 2016 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_PUBLIC_KEY_CRYPTO)
10
   #include <botan/internal/workfactor.h>
11
#endif
12

13
namespace Botan_Tests {
14

15
#if defined(BOTAN_HAS_PUBLIC_KEY_CRYPTO)
16
class PK_Workfactor_Tests final : public Text_Based_Test {
×
17
   public:
18
      PK_Workfactor_Tests() : Text_Based_Test("pubkey/workfactor.vec", "ParamSize,Workfactor") {}
3✔
19

20
      Test::Result run_one_test(const std::string& type, const VarMap& vars) override {
16✔
21
         const size_t param_size = vars.get_req_sz("ParamSize");
16✔
22
         const size_t exp_output = vars.get_req_sz("Workfactor");
16✔
23

24
         size_t output = 0;
16✔
25

26
         // TODO: test McEliece strength tests also
27

28
         if(type == "RSA_Strength") {
16✔
29
            output = Botan::if_work_factor(param_size);
8✔
30
         } else if(type == "DL_Exponent_Size") {
8✔
31
            output = Botan::dl_exponent_size(param_size);
8✔
32
         }
33

34
         Test::Result result(type + " work factor calculation");
16✔
35
         result.test_eq("Calculated workfactor for " + std::to_string(param_size), output, exp_output);
32✔
36
         return result;
16✔
37
      }
×
38
};
39

40
BOTAN_REGISTER_TEST("pubkey", "pk_workfactor", PK_Workfactor_Tests);
41
#endif
42

43
}  // 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