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

randombit / botan / 21753596263

06 Feb 2026 02:13PM UTC coverage: 90.063% (-0.01%) from 90.073%
21753596263

Pull #5289

github

web-flow
Merge 587099284 into 8ea0ca252
Pull Request #5289: Further misc header reductions, forward declarations, etc

102237 of 113517 relevant lines covered (90.06%)

11402137.11 hits per line

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

88.0
/src/tests/test_siv.cpp
1
/*
2
* (C) 2017 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_AEAD_SIV)
10
   #include <botan/aead.h>
11
   #include <botan/hex.h>
12
   #include <botan/internal/parsing.h>
13
#endif
14

15
namespace Botan_Tests {
16

17
namespace {
18

19
#if defined(BOTAN_HAS_AEAD_SIV)
20

21
class SIV_Tests final : public Text_Based_Test {
×
22
   public:
23
      SIV_Tests() : Text_Based_Test("siv_ad.vec", "Key,In,ADs,Out", "Nonce") {}
2✔
24

25
      Test::Result run_one_test(const std::string& algo, const VarMap& vars) override {
5✔
26
         const std::vector<uint8_t> key = vars.get_req_bin("Key");
5✔
27
         const std::vector<uint8_t> nonce = vars.get_opt_bin("Nonce");
5✔
28
         const std::vector<uint8_t> input = vars.get_req_bin("In");
5✔
29
         const std::vector<uint8_t> expected = vars.get_req_bin("Out");
5✔
30
         const std::vector<std::string> ad_list = Botan::split_on(vars.get_req_str("ADs"), ',');
10✔
31

32
         const std::string siv_name = algo + "/SIV";
5✔
33

34
         Test::Result result(siv_name);
10✔
35

36
         auto siv = Botan::AEAD_Mode::create(siv_name, Botan::Cipher_Dir::Encryption);
5✔
37

38
         if(!siv) {
5✔
39
            result.test_note("Skipping test due to missing cipher");
×
40
            return result;
×
41
         }
42

43
         siv->set_key(key);
5✔
44

45
         for(size_t i = 0; i != ad_list.size(); ++i) {
21✔
46
            std::vector<uint8_t> ad = Botan::hex_decode(ad_list[i]);
16✔
47
            siv->set_associated_data_n(i, ad);
16✔
48
         }
16✔
49

50
         Botan::secure_vector<uint8_t> buf(input.begin(), input.end());
5✔
51
         siv->start(nonce);
5✔
52
         siv->finish(buf, 0);
5✔
53

54
         result.test_eq("SIV ciphertext", buf, expected);
10✔
55

56
         return result;
5✔
57
      }
25✔
58
};
59

60
BOTAN_REGISTER_TEST("modes", "siv_ad", SIV_Tests);
61

62
#endif
63

64
}  // namespace
65

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

© 2026 Coveralls, Inc