9#ifndef BOTAN_AEAD_OCB_H_
10#define BOTAN_AEAD_OCB_H_
12#include <botan/aead.h>
13#include <botan/block_cipher.h>
33 void set_associated_data_n(
size_t idx, std::span<const uint8_t> ad)
override final;
35 std::string
name()
const override final;
37 size_t update_granularity()
const override final;
39 size_t ideal_granularity()
const override final;
43 bool valid_nonce_length(
size_t)
const override final;
47 void clear() override
final;
49 void reset() override
final;
51 bool has_keying_material() const override
final;
62 size_t block_size()
const {
return m_block_size; }
66 size_t par_bytes()
const {
return m_checksum.size(); }
70 std::unique_ptr<L_computer>
m_L;
72 size_t m_block_index = 0;
78 void start_msg(
const uint8_t nonce[],
size_t nonce_len)
override final;
80 void key_schedule(std::span<const uint8_t> key)
override final;
84 const size_t m_tag_size;
85 const size_t m_block_size;
86 const size_t m_par_blocks;
100 OCB_Mode(std::move(cipher), tag_size) {}
102 size_t output_length(
size_t input_length)
const override {
return input_length + tag_size(); }
107 void encrypt(uint8_t input[],
size_t blocks);
108 size_t process_msg(uint8_t buf[],
size_t size)
override;
119 OCB_Mode(std::move(cipher), tag_size) {}
122 BOTAN_ASSERT(input_length >= tag_size(),
"Sufficient input");
123 return input_length - tag_size();
129 void decrypt(uint8_t input[],
size_t blocks);
130 size_t process_msg(uint8_t buf[],
size_t size)
override;
#define BOTAN_ASSERT(expr, assertion_made)
size_t output_length(size_t input_length) const override
size_t minimum_final_size() const override
OCB_Decryption(std::unique_ptr< BlockCipher > cipher, size_t tag_size=16)
OCB_Encryption(std::unique_ptr< BlockCipher > cipher, size_t tag_size=16)
size_t minimum_final_size() const override
size_t output_length(size_t input_length) const override
size_t par_blocks() const
size_t tag_size() const override final
secure_vector< uint8_t > m_checksum
std::unique_ptr< BlockCipher > m_cipher
secure_vector< uint8_t > m_ad_hash
std::unique_ptr< L_computer > m_L
int(* final)(unsigned char *, CTX *)
std::vector< T, secure_allocator< T > > secure_vector