lilcrypto.h: group all struct defintions together

This commit is contained in:
Lucas Gabriel Vuotto 2024-06-09 14:55:34 +00:00
parent c2f630ceea
commit af3fe8a67a

View File

@ -51,10 +51,25 @@
/* /*
* Arguments. * Structs.
*/ */
/* Authentication */ struct lc_aead_impl;
struct lc_auth_ctx;
struct lc_auth_impl;
struct lc_cipher_ctx;
struct lc_cipher_impl;
struct lc_hash_ctx;
struct lc_hash_impl;
/*
* Parameters.
*/
/* Authentication. */
struct lc_hmac_params { struct lc_hmac_params {
size_t keylen; size_t keylen;
@ -103,10 +118,6 @@ uint32_t lc_ct_cmp(const uint8_t *, const uint8_t *, size_t);
* Hashes. * Hashes.
*/ */
struct lc_hash_ctx;
struct lc_hash_impl;
int lc_hash_init(struct lc_hash_ctx *); int lc_hash_init(struct lc_hash_ctx *);
int lc_hash_update(struct lc_hash_ctx *, const uint8_t *, size_t); int lc_hash_update(struct lc_hash_ctx *, const uint8_t *, size_t);
int lc_hash_final(struct lc_hash_ctx *, uint8_t *, size_t *); int lc_hash_final(struct lc_hash_ctx *, uint8_t *, size_t *);
@ -126,10 +137,6 @@ const struct lc_hash_impl *lc_hash_impl_sha512(void);
* Authentication. * Authentication.
*/ */
struct lc_auth_ctx;
struct lc_auth_impl;
int lc_auth_init(struct lc_auth_ctx *, const void *); int lc_auth_init(struct lc_auth_ctx *, const void *);
int lc_auth_update(struct lc_auth_ctx *, const uint8_t *, size_t); int lc_auth_update(struct lc_auth_ctx *, const uint8_t *, size_t);
int lc_auth_final(struct lc_auth_ctx *, uint8_t *, size_t *); int lc_auth_final(struct lc_auth_ctx *, uint8_t *, size_t *);
@ -150,10 +157,6 @@ const struct lc_auth_impl *lc_auth_impl_hmac_sha512(void);
* Ciphers. * Ciphers.
*/ */
struct lc_cipher_ctx;
struct lc_cipher_impl;
int lc_cipher_encrypt_init(struct lc_cipher_ctx *, const void *); int lc_cipher_encrypt_init(struct lc_cipher_ctx *, const void *);
int lc_cipher_encrypt_update(struct lc_cipher_ctx *, uint8_t *, size_t *, int lc_cipher_encrypt_update(struct lc_cipher_ctx *, uint8_t *, size_t *,
const uint8_t *, size_t); const uint8_t *, size_t);
@ -178,9 +181,6 @@ const struct lc_cipher_impl *lc_cipher_impl_xchacha20(void);
* Authenticated encryption with additional data. * Authenticated encryption with additional data.
*/ */
struct lc_aead_impl;
int lc_aead_seal(const struct lc_aead_impl *, uint8_t *, size_t *, int lc_aead_seal(const struct lc_aead_impl *, uint8_t *, size_t *,
const void *, 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 *, int lc_aead_open(const struct lc_aead_impl *, uint8_t *, size_t *,