Botan 3.6.1
Crypto and TLS for C&
ofb.h
Go to the documentation of this file.
1/*
2* OFB Mode
3* (C) 1999-2007 Jack Lloyd
4*
5* Botan is released under the Simplified BSD License (see license.txt)
6*/
7
8#ifndef BOTAN_OUTPUT_FEEDBACK_MODE_H_
9#define BOTAN_OUTPUT_FEEDBACK_MODE_H_
10
11#include <botan/block_cipher.h>
12#include <botan/stream_cipher.h>
13
14namespace Botan {
15
16/**
17* Output Feedback Mode
18*/
19class OFB final : public StreamCipher {
20 public:
21 size_t default_iv_length() const override;
22
23 bool valid_iv_length(size_t iv_len) const override;
24
25 Key_Length_Specification key_spec() const override;
26
27 std::string name() const override;
28
29 std::unique_ptr<StreamCipher> new_object() const override;
30
31 void clear() override;
32
33 bool has_keying_material() const override;
34
35 size_t buffer_size() const override;
36
37 /**
38 * @param cipher the block cipher to use
39 */
40 explicit OFB(std::unique_ptr<BlockCipher> cipher);
41
42 void seek(uint64_t offset) override;
43
44 private:
45 void key_schedule(std::span<const uint8_t> key) override;
46 void cipher_bytes(const uint8_t in[], uint8_t out[], size_t length) override;
47 void set_iv_bytes(const uint8_t iv[], size_t iv_len) override;
48
49 std::unique_ptr<BlockCipher> m_cipher;
51 size_t m_buf_pos;
52};
53
54} // namespace Botan
55
56#endif
size_t default_iv_length() const override
Definition ofb.cpp:43
std::string name() const override
Definition ofb.cpp:39
void clear() override
Definition ofb.cpp:18
bool valid_iv_length(size_t iv_len) const override
Definition ofb.cpp:47
size_t buffer_size() const override
Definition ofb.cpp:28
bool has_keying_material() const override
Definition ofb.cpp:24
OFB(std::unique_ptr< BlockCipher > cipher)
Definition ofb.cpp:15
void seek(uint64_t offset) override
Definition ofb.cpp:85
Key_Length_Specification key_spec() const override
Definition ofb.cpp:51
std::unique_ptr< StreamCipher > new_object() const override
Definition ofb.cpp:55
void cipher(const uint8_t in[], uint8_t out[], size_t len)
int(* final)(unsigned char *, CTX *)
std::vector< T, secure_allocator< T > > secure_vector
Definition secmem.h:61