29 #ifndef LCX_CHACHA_POLY_H
30 #define LCX_CHACHA_POLY_H
32 #if defined(HAVE_CHACHA_POLY)
33 #if defined(HAVE_POLY1305) && defined(HAVE_CHACHA)
41 cx_chacha_context_t chacha20_ctx;
42 cx_poly1305_context_t poly1305_ctx;
44 size_t ciphertext_len;
47 } cx_chachapoly_context_t;
49 void cx_chachapoly_init(cx_chachapoly_context_t *ctx);
51 WARN_UNUSED_RESULT cx_err_t cx_chachapoly_set_key(cx_chachapoly_context_t *ctx,
55 WARN_UNUSED_RESULT cx_err_t cx_chachapoly_start(cx_chachapoly_context_t *ctx,
60 WARN_UNUSED_RESULT cx_err_t cx_chachapoly_update_aad(cx_chachapoly_context_t *ctx,
64 WARN_UNUSED_RESULT cx_err_t cx_chachapoly_update(cx_chachapoly_context_t *ctx,
69 WARN_UNUSED_RESULT cx_err_t cx_chachapoly_finish(cx_chachapoly_context_t *ctx,
73 WARN_UNUSED_RESULT cx_err_t cx_chachapoly_encrypt_and_tag(cx_chachapoly_context_t *ctx,
84 WARN_UNUSED_RESULT cx_err_t cx_chachapoly_decrypt_and_auth(cx_chachapoly_context_t *ctx,
95 WARN_UNUSED_RESULT cx_err_t cx_chachapoly_check_tag(cx_chachapoly_context_t *ctx,
POLY1305 Message Authentication Code.