File syn_chacha20poly1305.h¶
File List > crypto > syn_chacha20poly1305.h
Go to the documentation of this file
#ifndef SYN_CHACHA20POLY1305_H
#define SYN_CHACHA20POLY1305_H
#if __has_include("syn_config.h")
#include "syn_config.h"
#endif
#if !defined(SYN_USE_CHACHA20POLY1305) || SYN_USE_CHACHA20POLY1305
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
/* ── ChaCha20 ───────────────────────────────────────────────────────────── */
void syn_chacha20_xor(const uint8_t key[32], const uint8_t nonce[12], uint32_t counter,
const uint8_t *in, size_t len, uint8_t *out);
void syn_chacha20_block(const uint8_t key[32], const uint8_t nonce[12], uint32_t counter,
uint8_t out[64]);
/* ── ChaCha20-Poly1305 AEAD ─────────────────────────────────────────────── */
void syn_aead_encrypt(const uint8_t key[32], const uint8_t nonce[12], const uint8_t *aad,
size_t aad_len, const uint8_t *plaintext, size_t pt_len, uint8_t *ciphertext,
uint8_t tag[16]);
bool syn_aead_decrypt(const uint8_t key[32], const uint8_t nonce[12], const uint8_t *aad,
size_t aad_len, const uint8_t *ciphertext, size_t ct_len,
const uint8_t tag[16], uint8_t *plaintext);
void syn_aead_encrypt_inplace(const uint8_t key[32], const uint8_t nonce[12], const uint8_t *aad,
size_t aad_len, uint8_t *buf, size_t len, uint8_t tag[16]);
bool syn_aead_decrypt_inplace(const uint8_t key[32], const uint8_t nonce[12], const uint8_t *aad,
size_t aad_len, uint8_t *buf, size_t len, const uint8_t tag[16]);
#ifdef __cplusplus
}
#endif
#endif /* SYN_USE_CHACHA20POLY1305 */
#endif /* SYN_CHACHA20POLY1305_H */