41#if defined(HAVE_AES_GCM)
44#if defined(HAVE_CHACHA_POLY) && defined(HAVE_CHACHA) && defined(HAVE_POLY1305)
48#define GCM_MAX_IV_LENGTH 64
49#define MAX_TAG_LENGTH 16
58 CX_AEAD_CHACHA20_POLY1305
66 void (*init)(
void *ctx);
67 cx_err_t (*set_key)(
void *ctx,
const uint8_t *key,
size_t key_len);
68 cx_err_t (*start)(
void *ctx,
72 cx_err_t (*update_aad)(
void *ctx,
75 cx_err_t (*update)(
void *ctx,
79 cx_err_t (*finish)(
void *ctx,
82 cx_err_t (*encrypt_and_tag)(
void *ctx,
93 cx_err_t (*auth_decrypt)(
void *ctx,
103 cx_err_t (*check_tag)(
void *ctx,
const uint8_t *tag,
size_t tag_len);
113 const cx_aead_base_t *func;
121 const cx_aead_info_t *info;
144WARN_UNUSED_RESULT cx_err_t cx_aead_init(cx_aead_context_t *ctx);
161WARN_UNUSED_RESULT cx_err_t cx_aead_setup(cx_aead_context_t *ctx, cx_aead_type_t type);
179WARN_UNUSED_RESULT cx_err_t cx_aead_set_key(cx_aead_context_t *ctx,
197WARN_UNUSED_RESULT cx_err_t cx_aead_set_iv(cx_aead_context_t *ctx,
215WARN_UNUSED_RESULT cx_err_t cx_aead_update_ad(cx_aead_context_t *ctx,
239WARN_UNUSED_RESULT cx_err_t
240cx_aead_update(cx_aead_context_t *ctx,
uint8_t *in,
size_t in_len,
uint8_t *out,
size_t *out_len);
255WARN_UNUSED_RESULT cx_err_t cx_aead_write_tag(cx_aead_context_t *ctx,
uint8_t *tag,
size_t tag_len);
270WARN_UNUSED_RESULT cx_err_t cx_aead_check_tag(cx_aead_context_t *ctx,
304WARN_UNUSED_RESULT cx_err_t cx_aead_encrypt(cx_aead_context_t *ctx,
347WARN_UNUSED_RESULT cx_err_t cx_aead_decrypt(cx_aead_context_t *ctx,
AES in Galois/Counter Mode (AES-GCM)
CHACHA20_POLY1305 Authenticated Encryption with Additional Data (AEAD)