randombit / botan

@@ -30,7 +30,7 @@
Loading
30 30
      Test::Result run_one_test(const std::string& algo, const VarMap& vars) override
31 31
         {
32 32
         const std::vector<uint8_t> key      = vars.get_req_bin("Key");
33 -
         const std::vector<uint8_t> nonce    = vars.get_opt_bin("Nonce");
33 +
         const std::vector<uint8_t> nonce    = vars.get_req_bin("Nonce");
34 34
         const std::vector<uint8_t> input    = vars.get_req_bin("In");
35 35
         const std::vector<uint8_t> expected = vars.get_req_bin("Out");
36 36

@@ -158,9 +158,10 @@
Loading
158 158
Nonce::Nonce(const std::vector<uint8_t>& nonce)
159 159
   {
160 160
   if(nonce.size() != 64)
161 -
      { throw Invalid_Argument("Nonce lenght must be 64"); }
161 +
      { throw Invalid_Argument("Roughtime nonce must be 64 bytes long"); }
162 162
   m_nonce = typecast_copy<std::array<uint8_t, 64>>(nonce.data());
163 163
   }
164 +
164 165
Nonce::Nonce(RandomNumberGenerator& rng)
165 166
   {
166 167
   rng.randomize(m_nonce.data(), m_nonce.size());

@@ -20,7 +20,7 @@
Loading
20 20
class SIV_Tests final : public Text_Based_Test
21 21
   {
22 22
   public:
23 -
      SIV_Tests() : Text_Based_Test("siv_ad.vec", "Key,In,Out", "Nonce,ADs") {}
23 +
      SIV_Tests() : Text_Based_Test("siv_ad.vec", "Key,In,ADs,Out", "Nonce") {}
24 24
25 25
      Test::Result run_one_test(const std::string& algo, const VarMap& vars) override
26 26
         {

@@ -5,9 +5,6 @@
Loading
5 5
*/
6 6
7 7
#include "tests.h"
8 -
9 -
#include <cassert>
10 -
11 8
#include "test_rng.h"
12 9
13 10
#if defined(BOTAN_HAS_BIGINT)
@@ -20,6 +17,7 @@
Loading
20 17
   #include <botan/hex.h>
21 18
   #include <botan/roughtime.h>
22 19
#endif
20 +
23 21
namespace Botan_Tests {
24 22
25 23
#if defined(BOTAN_HAS_ROUGHTIME)
@@ -32,7 +30,7 @@
Loading
32 30
33 31
      Test::Result run_one_test(const std::string& type, const VarMap& vars) override
34 32
         {
35 -
         Test::Result result("roughtime request");
33 +
         Test::Result result("Roughtime request");
36 34
37 35
         const auto nonce = vars.get_req_bin("Nonce");
38 36
         const auto request_v = vars.get_req_bin("Request");
@@ -60,18 +58,19 @@
Loading
60 58
61 59
      Test::Result run_one_test(const std::string& type, const VarMap& vars) override
62 60
         {
63 -
         Test::Result result("roughtime response");
61 +
         Test::Result result("Roughtime response");
64 62
65 63
         const auto response_v = vars.get_req_bin("Response");
66 -
         const auto n = vars.has_key("Nonce") ? vars.get_req_bin("Nonce") : std::vector<uint8_t>(64);
67 -
         assert(n.size() == 64);
68 -
         const Botan::Roughtime::Nonce nonce(n);
64 +
         const auto nonce_bits = vars.has_key("Nonce") ? vars.get_opt_bin("Nonce") : std::vector<uint8_t>(64);
65 +
66 +
         const Botan::Roughtime::Nonce nonce(nonce_bits);
69 67
         try
70 68
            {
71 69
            const auto response = Botan::Roughtime::Response::from_bits(response_v, nonce);
72 70
73 71
            const auto pubkey = vars.get_req_bin("Pubkey");
74 -
            assert(pubkey.size() == 32);
72 +
            if(pubkey.size() != 32)
73 +
               throw Test_Error("Unexpected Roughtime Ed25519 pubkey size");
75 74
76 75
            if(!response.validate(Botan::Ed25519_PublicKey(pubkey)))
77 76
               {
Files Coverage
src 92.31%
Project Totals (567 files) 92.31%
1
---
2

3
# Documentation
4
# https://github.com/codecov/support/wiki/Codecov-Yaml#full-yaml
5
#
6
# Validate this file
7
# curl --data-binary @codecov.yml https://codecov.io/validate
8

9
coverage:
10
  status:
11
    project:
12
      default:
13
        # Random seeds in tests lead to a +/-0.05% coverage span even for PRs
14
        # that do not change source code
15
        threshold: 0.05
Sunburst
The inner-most circle is the entire project, moving away from the center are folders then, finally, a single file. The size and color of each slice is representing the number of statements and the coverage, respectively.
Icicle
The top section represents the entire project. Proceeding with folders and finally individual files. The size and color of each slice is representing the number of statements and the coverage, respectively.
Grid
Each block represents a single file in the project. The size and color of each block is represented by the number of statements and the coverage, respectively.
Loading