8#ifndef BOTAN_AEAD_GCM_SIV_H_
9#define BOTAN_AEAD_GCM_SIV_H_
11#include <botan/aead.h>
13#include <botan/block_cipher.h>
14#include <botan/internal/polyval.h>
25 std::string
name()
const final;
55 static constexpr
size_t BS = 16;
58 static constexpr uint64_t
MAX_INPUT_LEN = static_cast<uint64_t>(1) << 36;
62 bool in_msg()
const {
return m_in_msg; }
65 std::array<uint8_t, BS>
compute_tag(std::span<const uint8_t> ptext);
68 void ctr_xor(std::span<const uint8_t, BS> tag, uint8_t buf[],
size_t len);
71 void start_msg(
const uint8_t nonce[],
size_t nonce_len)
final;
72 size_t process_msg(uint8_t buf[],
size_t size)
final;
74 void key_schedule(std::span<const uint8_t> key)
final;
76 const std::string m_cipher_name;
79 std::unique_ptr<BlockCipher> m_cipher;
80 std::unique_ptr<BlockCipher> m_msg_cipher;
84 std::array<uint8_t, 12> m_nonce{};
87 bool m_in_msg =
false;
size_t output_length(size_t input_length) const override
size_t minimum_final_size() const override
GCM_SIV_Decryption(std::unique_ptr< BlockCipher > cipher)
size_t minimum_final_size() const override
size_t output_length(size_t input_length) const override
GCM_SIV_Encryption(std::unique_ptr< BlockCipher > cipher)
std::string name() const final
static constexpr size_t BS
static constexpr uint64_t MAX_INPUT_LEN
RFC 8452 limits both the plaintext and the AD to 2**36 bytes.
bool valid_nonce_length(size_t len) const final
std::string provider() const final
size_t ideal_granularity() const final
void ctr_xor(std::span< const uint8_t, BS > tag, uint8_t buf[], size_t len)
XOR the buffer with the CTR keystream, starting from the tag-derived counter.
size_t tag_size() const final
Key_Length_Specification key_spec() const final
bool has_keying_material() const final
bool associated_data_requires_key() const final
The AD is buffered as-is; it is not processed until finish.
secure_vector< uint8_t > & msg_buf()
bool requires_entire_message() const final
size_t update_granularity() const final
void set_associated_data_n(size_t idx, std::span< const uint8_t > ad) final
GCM_SIV_Mode(std::unique_ptr< BlockCipher > cipher)
std::array< uint8_t, BS > compute_tag(std::span< const uint8_t > ptext)
Compute the expected tag for the (unpadded) plaintext.
std::vector< T, secure_allocator< T > > secure_vector