This commit is contained in:
Lucas Gabriel Vuotto 2024-06-10 17:23:48 +00:00
parent 2ebe3467f8
commit f6bddfcd70
6 changed files with 18 additions and 0 deletions

2
aead.h
View File

@ -23,4 +23,6 @@ struct lc_aead_impl {
const uint8_t *, size_t); const uint8_t *, size_t);
int (*open)(uint8_t *, size_t *, void *, const uint8_t *, size_t, int (*open)(uint8_t *, size_t *, void *, const uint8_t *, size_t,
const uint8_t *, size_t); const uint8_t *, size_t);
size_t blocklen;
}; };

View File

@ -419,11 +419,15 @@ xchacha20_poly1305_open(uint8_t *out, size_t *outlen, void *initparams,
static struct lc_aead_impl chacha20_poly1305_impl = { static struct lc_aead_impl chacha20_poly1305_impl = {
.seal = &chacha20_poly1305_seal, .seal = &chacha20_poly1305_seal,
.open = &chacha20_poly1305_open, .open = &chacha20_poly1305_open,
.blocklen = LC_CHACHA20_BLOCKLEN,
}; };
static struct lc_aead_impl xchacha20_poly1305_impl = { static struct lc_aead_impl xchacha20_poly1305_impl = {
.seal = &xchacha20_poly1305_seal, .seal = &xchacha20_poly1305_seal,
.open = &xchacha20_poly1305_open, .open = &xchacha20_poly1305_open,
.blocklen = LC_XCHACHA20_BLOCKLEN,
}; };
const struct lc_aead_impl * const struct lc_aead_impl *

3
auth.h
View File

@ -26,6 +26,9 @@ struct lc_auth_impl {
void *(*ctx_new)(void); void *(*ctx_new)(void);
void (*ctx_free)(void *); void (*ctx_free)(void *);
size_t blocklen;
size_t taglen;
}; };
struct lc_auth_ctx { struct lc_auth_ctx {

View File

@ -165,6 +165,9 @@ static struct lc_auth_impl poly1305_impl = {
.ctx_new = &poly1305_ctx_new, .ctx_new = &poly1305_ctx_new,
.ctx_free = NULL, .ctx_free = NULL,
.blocklen = LC_POLY1305_BLOCKLEN,
.taglen = LC_POLY1305_TAGLEN,
}; };
const struct lc_auth_impl * const struct lc_auth_impl *

View File

@ -35,6 +35,8 @@ struct lc_cipher_impl {
void *(*ctx_new)(void); void *(*ctx_new)(void);
void (*ctx_free)(void *); void (*ctx_free)(void *);
size_t blocklen;
}; };
struct lc_cipher_ctx { struct lc_cipher_ctx {

View File

@ -229,6 +229,8 @@ static struct lc_cipher_impl chacha20_impl = {
.ctx_new = &chacha20_ctx_new, .ctx_new = &chacha20_ctx_new,
.ctx_free = NULL, .ctx_free = NULL,
.blocklen = LC_CHACHA20_BLOCKLEN,
}; };
static struct lc_cipher_impl xchacha20_impl = { static struct lc_cipher_impl xchacha20_impl = {
@ -244,6 +246,8 @@ static struct lc_cipher_impl xchacha20_impl = {
.ctx_new = &chacha20_ctx_new, .ctx_new = &chacha20_ctx_new,
.ctx_free = NULL, .ctx_free = NULL,
.blocklen = LC_XCHACHA20_BLOCKLEN,
}; };
const struct lc_cipher_impl * const struct lc_cipher_impl *