34#define CHACHA20POLY1305_KEY_BYTES (32U)
35#define CHACHA20POLY1305_NONCE_BYTES (12U)
36#define CHACHA20POLY1305_TAG_BYTES (16U)
73 size_t msglen, const uint8_t *aad,
size_t aadlen,
74 const uint8_t *key, const uint8_t *nonce);
99 uint8_t *msg,
size_t *msglen,
100 const uint8_t *aad,
size_t aadlen,
101 const uint8_t *key, const uint8_t *nonce);
117 const uint8_t *key, const uint8_t *nonce,
Common macros and compiler attributes/pragmas configuration.
#define ACCESS(mode, ptr_idx, size_idx)
Emit an attribute (if supported by the compiler) that declares how a function will access its paramet...
int chacha20poly1305_decrypt(const uint8_t *cipher, size_t cipherlen, uint8_t *msg, size_t *msglen, const uint8_t *aad, size_t aadlen, const uint8_t *key, const uint8_t *nonce)
Verify the tag and decrypt a ciphertext to plaintext.
void chacha20_encrypt_decrypt(const uint8_t *input, uint8_t *output, const uint8_t *key, const uint8_t *nonce, size_t inputlen)
Encrypt a plaintext to ciphertext with the ChaCha20 algorithm.
void chacha20poly1305_encrypt(uint8_t *cipher, const uint8_t *msg, size_t msglen, const uint8_t *aad, size_t aadlen, const uint8_t *key, const uint8_t *nonce)
Encrypt a plaintext to ciphertext and append a tag to protect the ciphertext and additional data.
Chacha20poly1305 state struct.
uint32_t state[16]
The current state of the key stream.
poly1305_ctx_t poly
Poly1305 state for the MAC.