5 #if defined(HAVE_CONFIG_H)
20 #ifndef HAVE_TIMINGSAFE_BCMP
24 const unsigned char *p1 = b1, *p2 = b2;
48 bool ChaCha20Poly1305AEAD::Crypt(uint64_t seqnr_payload, uint64_t seqnr_aad,
int aad_pos,
unsigned char* dest,
size_t dest_len ,
const unsigned char* src,
size_t src_len,
bool is_encrypt)
60 memset(poly_key, 0,
sizeof(poly_key));
static constexpr int CHACHA20_POLY1305_AEAD_KEY_LEN
static constexpr int CHACHA20_POLY1305_AEAD_AAD_LEN
static constexpr int CHACHA20_ROUND_OUTPUT
void SetKey32(const unsigned char *key32)
set 32-byte key.
void Keystream(unsigned char *c, size_t bytes)
outputs the keystream of size <bytes> into
void Seek64(Nonce96 nonce, uint32_t block_counter)
Set the 96-bit nonce and 32-bit block counter.
void Crypt(const unsigned char *input, unsigned char *output, size_t bytes)
enciphers the message <input> of length <bytes> and write the enciphered representation into <output>...
uint64_t m_cached_aad_seqnr
bool Crypt(uint64_t seqnr_payload, uint64_t seqnr_aad, int aad_pos, unsigned char *dest, size_t dest_len, const unsigned char *src, size_t src_len, bool is_encrypt)
Encrypts/decrypts a packet seqnr_payload, the message sequence number seqnr_aad, the messages AAD seq...
bool GetLength(uint32_t *len24_out, uint64_t seqnr_aad, int aad_pos, const uint8_t *ciphertext)
decrypts the 3 bytes AAD data and decodes it into a uint32_t field
ChaCha20Poly1305AEAD(const unsigned char *K_1, size_t K_1_len, const unsigned char *K_2, size_t K_2_len)
unsigned char m_aad_keystream_buffer[CHACHA20_ROUND_OUTPUT]
C++ wrapper with std::byte Span interface around poly1305_donna code.
static constexpr unsigned KEYLEN
Length of the keys expected by the constructor.
static constexpr unsigned TAGLEN
Length of the output produced by Finalize().
A Span is an object that can refer to a contiguous sequence of objects.
void memory_cleanse(void *ptr, size_t len)
Secure overwrite a buffer (possibly containing secret data) with zero-bytes.
int timingsafe_bcmp(const unsigned char *b1, const unsigned char *b2, size_t n)
Span< std::byte > AsWritableBytes(Span< T > s) noexcept
Span< const std::byte > MakeByteSpan(V &&v) noexcept
Span< const std::byte > AsBytes(Span< T > s) noexcept
Span< std::byte > MakeWritableByteSpan(V &&v) noexcept