Botan  1.10.9
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 
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
size_t block_size
Definition: ossl_md.cpp:41
Definition: ofb.h:19
Key_Length_Specification key_spec() const
Definition: ofb.h:29
unsigned char byte
Definition: types.h:22
OFB * clone() const
Definition: ofb.h:36
bool valid_iv_length(size_t iv_len) const
Definition: ofb.h:26