Botan 3.0.0
Crypto and TLS for C&
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
13namespace Botan {
14
15/**
16* Block Cipher Cascade
17*/
19 {
20 public:
21 void encrypt_n(const uint8_t in[], uint8_t out[], size_t blocks) const override;
22 void decrypt_n(const uint8_t in[], uint8_t out[], size_t blocks) const override;
23
24 size_t block_size() const override { return m_block_size; }
25
27 {
28 return Key_Length_Specification(m_cipher1->maximum_keylength() +
29 m_cipher2->maximum_keylength());
30 }
31
32 void clear() override;
33 std::string name() const override;
34 std::unique_ptr<BlockCipher> new_object() const override;
35
36 bool has_keying_material() 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(std::unique_ptr<BlockCipher> cipher1,
44 std::unique_ptr<BlockCipher> cipher2);
45
48 private:
49 void key_schedule(const uint8_t[], size_t) override;
50
51 std::unique_ptr<BlockCipher> m_cipher1, m_cipher2;
52 size_t m_block_size;
53 };
54
55
56}
57
58#endif
bool has_keying_material() const override
Definition: cascade.cpp:52
Cascade_Cipher & operator=(const Cascade_Cipher &)=delete
std::string name() const override
Definition: cascade.cpp:47
Key_Length_Specification key_spec() const override
Definition: cascade.h:26
std::unique_ptr< BlockCipher > new_object() const override
Definition: cascade.cpp:58
void encrypt_n(const uint8_t in[], uint8_t out[], size_t blocks) const override
Definition: cascade.cpp:13
Cascade_Cipher(const Cascade_Cipher &)=delete
void clear() override
Definition: cascade.cpp:41
void decrypt_n(const uint8_t in[], uint8_t out[], size_t blocks) const override
Definition: cascade.cpp:23
size_t block_size() const override
Definition: cascade.h:24
int(* final)(unsigned char *, CTX *)
Definition: alg_id.cpp:12