5 #ifndef BITCOIN_CRYPTO_CHACHA_POLY_AEAD_H
6 #define BITCOIN_CRYPTO_CHACHA_POLY_AEAD_H
126 ChaCha20Poly1305AEAD(
const unsigned char* K_1,
size_t K_1_len,
const unsigned char* K_2,
size_t K_2_len);
140 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);
143 bool GetLength(uint32_t* len24_out, uint64_t seqnr_aad,
int aad_pos,
const uint8_t* ciphertext);
static constexpr int CHACHA20_POLY1305_AEAD_KEY_LEN
static constexpr int AAD_PACKAGES_PER_ROUND
static constexpr int CHACHA20_POLY1305_AEAD_AAD_LEN
static constexpr int CHACHA20_ROUND_OUTPUT
Unrestricted ChaCha20 cipher.
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)
ChaCha20Poly1305AEAD(const ChaCha20Poly1305AEAD &)=delete
unsigned char m_aad_keystream_buffer[CHACHA20_ROUND_OUTPUT]