10 #include <botan/parsing.h>
16 m_feedback_bytes(feedback_bits ? feedback_bits / 8 : cipher->block_size())
31 m_shift_register.clear();
32 m_keystream_buf.clear();
70 return (n ==
cipher().block_size());
73 void CFB_Mode::key_schedule(
const uint8_t key[],
size_t length)
75 m_cipher->set_key(key, length);
78 void CFB_Mode::start_msg(
const uint8_t nonce[],
size_t nonce_len)
81 throw Invalid_IV_Length(
name(), nonce_len);
83 m_shift_register.assign(nonce, nonce + nonce_len);
84 m_keystream_buf.resize(m_shift_register.size());
98 const size_t took =
std::min(shift, left);
104 copy_mem(state.data(), &state[shift], BS - shift);
106 copy_mem(&state[BS-shift], buf, took);
130 const size_t took =
std::min(shift, left);
135 copy_mem(state.data(), &state[shift], BS - shift);
137 copy_mem(&state[BS-shift], buf, took);
void xor_buf(T out[], const T in[], size_t length)
void encrypt(const uint8_t in[], uint8_t out[]) const
size_t update_granularity() const override
const BlockCipher & cipher() const
void finish(secure_vector< uint8_t > &final_block, size_t offset=0) override
Key_Length_Specification key_spec() const override
void update(secure_vector< uint8_t > &buffer, size_t offset=0)
std::string to_string(const BER_Object &obj)
CFB_Mode(BlockCipher *cipher, size_t feedback_bits)
secure_vector< uint8_t > & shift_register()
std::vector< T, secure_allocator< T >> secure_vector
virtual std::string name() const =0
size_t output_length(size_t input_length) const override
void finish(secure_vector< uint8_t > &final_block, size_t offset=0) override
void copy_mem(T *out, const T *in, size_t n)
size_t default_nonce_length() const override
size_t process(uint8_t buf[], size_t size) override
bool valid_nonce_length(size_t n) const override
virtual Key_Length_Specification key_spec() const =0
std::string name() const override
secure_vector< uint8_t > & keystream_buf()
size_t process(uint8_t buf[], size_t size) override
virtual size_t block_size() const =0
size_t minimum_final_size() const override