3
* (C) 1999-2007 Jack Lloyd
5
* Botan is released under the Simplified BSD License (see license.txt)
8
#ifndef BOTAN_OUTPUT_FEEDBACK_MODE_H_
9
#define BOTAN_OUTPUT_FEEDBACK_MODE_H_
11
#include <botan/stream_cipher.h>
12
#include <botan/block_cipher.h>
17
* Output Feedback Mode
19
class BOTAN_PUBLIC_API(2,0) OFB final : public StreamCipher
22
void cipher(const uint8_t in[], uint8_t out[], size_t length) override;
24
void set_iv(const uint8_t iv[], size_t iv_len) override;
26
bool valid_iv_length(size_t iv_len) const override
27
{ return (iv_len <= m_cipher->block_size()); }
29
Key_Length_Specification key_spec() const override
31
return m_cipher->key_spec();
34
std::string name() const override;
36
OFB* clone() const override
37
{ return new OFB(m_cipher->clone()); }
39
void clear() override;
42
* @param cipher the block cipher to use
44
explicit OFB(BlockCipher* cipher);
46
void seek(uint64_t offset) override;
48
void key_schedule(const uint8_t key[], size_t key_len) override;
50
std::unique_ptr<BlockCipher> m_cipher;
51
secure_vector<uint8_t> m_buffer;