Botan 2.13.0 Crypto and TLS for C++11

- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

cascade.h
Go to the documentation of this file.
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 BOTAN_FUTURE_INTERNAL_HEADER(cascade.h)
14
15 namespace Botan {
16
17 /**
18 * Block Cipher Cascade
19 */
20 class BOTAN_PUBLIC_API(2,0) Cascade_Cipher final : public BlockCipher
21 {
22 public:
23 void encrypt_n(const uint8_t in[], uint8_t out[], size_t blocks) const override;
24 void decrypt_n(const uint8_t in[], uint8_t out[], size_t blocks) const override;
25
26 size_t block_size() const override { return m_block; }
27
28 Key_Length_Specification key_spec() const override
29 {
30 return Key_Length_Specification(m_cipher1->maximum_keylength() +
31 m_cipher2->maximum_keylength());
32 }
33
34 void clear() override;
35 std::string name() const override;
36 BlockCipher* clone() const override;
37
38 /**
39 * Create a cascade of two block ciphers
40 * @param cipher1 the first cipher
41 * @param cipher2 the second cipher
42 */
43 Cascade_Cipher(BlockCipher* cipher1, BlockCipher* cipher2);
44
45 Cascade_Cipher(const Cascade_Cipher&) = delete;
46 Cascade_Cipher& operator=(const Cascade_Cipher&) = delete;
47 private:
48 void key_schedule(const uint8_t[], size_t) override;
49
50 size_t m_block;
51 std::unique_ptr<BlockCipher> m_cipher1, m_cipher2;
52 };
53
54
55 }
56
57 #endif
Botan::Cascade_Cipher::key_spec
Key_Length_Specification key_spec() const override
Definition: cascade.h:28
Botan::BlockCipher::decrypt_n
virtual void decrypt_n(const uint8_t in[], uint8_t out[], size_t blocks) const =0
Botan::Key_Length_Specification
Definition: key_spec.h:18
final
int(* final)(unsigned char *, CTX *)
Definition: commoncrypto_hash.cpp:28
BOTAN_PUBLIC_API
#define BOTAN_PUBLIC_API(maj, min)
Definition: compiler.h:31
Botan::BlockCipher::clone
virtual BlockCipher * clone() const =0
Botan::SymmetricAlgorithm::name
virtual std::string name() const =0
Botan::Cascade_Cipher::block_size
size_t block_size() const override
Definition: cascade.h:26
Botan::Cascade_Cipher
Definition: cascade.h:20
Botan::SymmetricAlgorithm::clear
virtual void clear()=0
Botan
Definition: alg_id.cpp:13
Botan::BlockCipher::encrypt_n
virtual void encrypt_n(const uint8_t in[], uint8_t out[], size_t blocks) const =0
BOTAN_FUTURE_INTERNAL_HEADER
#define BOTAN_FUTURE_INTERNAL_HEADER(hdr)
Definition: compiler.h:139
Botan::BlockCipher
Definition: block_cipher.h:21