aead: replace init args with implementation-specific params struct

This unbreaks {,X}ChaCha20-Poly1305. Thanks to the use of params, the
{,X}ChaCha20-Poly1305 doesn't need to reach into the guts of ChaCha20
state. Move {en,de}cryption and key setup into its own functions.

This breaks the tests, which will be fixed in the following commit.
This commit is contained in:
Lucas Gabriel Vuotto 2024-06-07 23:29:29 +00:00
parent 79ce4400dd
commit a6208487e4
4 changed files with 306 additions and 241 deletions

View file

@ -175,11 +175,9 @@ struct lc_aead_impl;
int lc_aead_seal(const struct lc_aead_impl *, uint8_t *, size_t *,
const uint8_t *, size_t, const uint8_t *, size_t, const uint8_t *,
size_t, const uint8_t *, size_t);
const void *, const uint8_t *, size_t, const uint8_t *, size_t);
int lc_aead_open(const struct lc_aead_impl *, uint8_t *, size_t *,
const uint8_t *, size_t, const uint8_t *, size_t, const uint8_t *,
size_t, const uint8_t *, size_t);
const void *, const uint8_t *, size_t, const uint8_t *, size_t);
const struct lc_aead_impl *lc_aead_impl_chacha20_poly1305(void);
const struct lc_aead_impl *lc_aead_impl_xchacha20_poly1305(void);