33 #define CHACHA20POLY1305_CONSTANT_BYTES (16U)
34 #define CHACHA20POLY1305_KEY_BYTES (32U)
35 #define CHACHA20POLY1305_COUNTER_BYTES (4U)
36 #define CHACHA20POLY1305_NONCE_BYTES (12U)
37 #define CHACHA20POLY1305_TAG_BYTES (16U)
38 #define CHACHA20POLY1305_BLOCK_BYTES (64U)
55 }__attribute__ ((__packed__)) split;
91 size_t msglen,
const uint8_t *aad,
size_t aadlen,
92 const uint8_t *key,
const uint8_t *nonce);
111 uint8_t *msg,
size_t *msglen,
112 const uint8_t *aad,
size_t aadlen,
113 const uint8_t *key,
const uint8_t *nonce);
128 const uint8_t *nonce,
130 const uint8_t *input,
144 const uint8_t *nonce,
145 const uint32_t counter);
155 const uint8_t *input,
167 const uint8_t *input,
#define CHACHA20POLY1305_BLOCK_BYTES
Block length in bytes.
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 *key, const uint8_t *nonce, uint32_t counter, const uint8_t *input, size_t input_length, uint8_t *output)
Encrypt a plaintext to ciphertext with the ChaCha20 algorithm.
void chacha20_update(chacha20_ctx_t *ctx, const uint8_t *input, uint8_t *output)
Update a ChaCha20 encrypt or decrypt multipart operation.
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.
#define CHACHA20POLY1305_KEY_BYTES
Key length in bytes.
void chacha20_finish(chacha20_ctx_t *ctx, const uint8_t *input, size_t input_length, uint8_t *output)
Finish a ChaCha20 encrypt or decrypt multipart operation.
#define CHACHA20POLY1305_CONSTANT_BYTES
Constants length in bytes.
#define CHACHA20POLY1305_NONCE_BYTES
Nonce length in bytes.
void chacha20_setup(chacha20_ctx_t *ctx, const uint8_t *key, const uint8_t *nonce, const uint32_t counter)
Setup a ChaCha20 encrypt or decrypt multipart operation.
#define CHACHA20POLY1305_COUNTER_BYTES
Counter length in bytes.
Context of a ChaCha20 multipart operation.
Chacha20poly1305 state struct.
chacha20_ctx_t chacha20
The context of the ChaCha20 operation.
poly1305_ctx_t poly
Poly1305 state for the MAC.