Botan 1.10.17

ofb.h
Go to the documentation of this file.
1 /*
2 * OFB Mode
3 * (C) 1999-2007 Jack Lloyd
4 *
5 * Distributed under the terms of the Botan license
6 */
7
8 #ifndef BOTAN_OUTPUT_FEEDBACK_MODE_H__
9 #define BOTAN_OUTPUT_FEEDBACK_MODE_H__
10
11 #include <botan/stream_cipher.h>
12 #include <botan/block_cipher.h>
13
14 namespace Botan {
15
16 /**
17 * Output Feedback Mode
18 */
19 class BOTAN_DLL OFB : public StreamCipher
20 {
21 public:
22 void cipher(const byte in[], byte out[], size_t length);
23
24 void set_iv(const byte iv[], size_t iv_len);
25
26 bool valid_iv_length(size_t iv_len) const
27 { return (iv_len <= permutation->block_size()); }
28
29 Key_Length_Specification key_spec() const
30 {
31 return permutation->key_spec();
32 }
33
34 std::string name() const;
35
36 OFB* clone() const
37 { return new OFB(permutation->clone()); }
38
39 void clear();
40
41 /**
42 * @param cipher the underlying block cipher to use
43 */
44 OFB(BlockCipher* cipher);
45 ~OFB();
46 private:
47 void key_schedule(const byte key[], size_t key_len);
48
49 BlockCipher* permutation;
50 SecureVector<byte> buffer;
51 size_t position;
52 };
53
54 }
55
56 #endif
Botan::OFB::clone
OFB * clone() const
Definition: ofb.h:36
Botan::OFB
Definition: ofb.h:19
Botan::Key_Length_Specification
Definition: key_spec.h:18
Botan::OFB::valid_iv_length
bool valid_iv_length(size_t iv_len) const
Definition: ofb.h:26
Botan::byte
unsigned char byte
Definition: types.h:22
Botan::StreamCipher
Definition: stream_cipher.h:18
Botan
Definition: algo_base.h:14
Botan::SecureVector< byte >
Botan::OFB::key_spec
Key_Length_Specification key_spec() const
Definition: ofb.h:29
Botan::BlockCipher
Definition: block_cipher.h:18