5 #if defined(HAVE_CONFIG_H)
20 #ifndef HAVE_TIMINGSAFE_BCMP
24 const unsigned char *p1 = b1, *p2 = b2;
47 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)
59 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 Keystream(unsigned char *c, size_t bytes)
outputs the keystream of size <bytes> into
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>...
void SetKey(const unsigned char *key, size_t keylen)
set key with flexible keylength; 256bit recommended */
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]
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)
void poly1305_auth(unsigned char out[POLY1305_TAGLEN], const unsigned char *m, size_t inlen, const unsigned char key[POLY1305_KEYLEN])