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

10
aead.h
View file

@ -19,10 +19,8 @@
struct lc_aead_impl {
int (*seal)(uint8_t *, size_t *, const uint8_t *, size_t,
const uint8_t *, size_t, const uint8_t *, size_t,
const uint8_t *, size_t);
int (*open)(uint8_t *, size_t *, const uint8_t *, size_t,
const uint8_t *, size_t, const uint8_t *, size_t,
const uint8_t *, size_t);
int (*seal)(uint8_t *, size_t *, const void *, const uint8_t *,
size_t, const uint8_t *, size_t);
int (*open)(uint8_t *, size_t *, const void *, const uint8_t *,
size_t, const uint8_t *, size_t);
};