Coverage Report

Created: 2026-10-10 06:25

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/botan/build/include/internal/botan/internal/cascade.h
Line
Count
Source
1
/*
2
* Block Cipher Cascade
3
* (C) 2010 Jack Lloyd
4
*
5
* Botan is released under the Simplified BSD License (see license.txt)
6
*/
7
8
#ifndef BOTAN_CASCADE_H_
9
#define BOTAN_CASCADE_H_
10
11
#include <botan/block_cipher.h>
12
13
namespace Botan {
14
15
/**
16
* Block Cipher Cascade
17
*/
18
class Cascade_Cipher final : public BlockCipher {
19
   public:
20
      void encrypt_n(const uint8_t in[], uint8_t out[], size_t blocks) const override;
21
      void decrypt_n(const uint8_t in[], uint8_t out[], size_t blocks) const override;
22
23
0
      size_t block_size() const override { return m_block_size; }
24
25
0
      Key_Length_Specification key_spec() const override {
26
0
         return Key_Length_Specification(m_cipher1->maximum_keylength() + m_cipher2->maximum_keylength());
27
0
      }
28
29
      void clear() override;
30
      std::string name() const override;
31
      std::unique_ptr<BlockCipher> new_object() const override;
32
33
      bool has_keying_material() const override;
34
35
      /**
36
      * Create a cascade of two block ciphers
37
      * @param cipher1 the first cipher
38
      * @param cipher2 the second cipher
39
      */
40
      Cascade_Cipher(std::unique_ptr<BlockCipher> cipher1, std::unique_ptr<BlockCipher> cipher2);
41
42
   private:
43
      void key_schedule(std::span<const uint8_t> key) override;
44
45
      std::unique_ptr<BlockCipher> m_cipher1, m_cipher2;
46
      size_t m_block_size;
47
};
48
49
}  // namespace Botan
50
51
#endif