Remove ctx_new and ctx_free function pointers

Now that HMAC isn't special anymore, and with the help of init params,
this isn't needed anymore as we only allocate memory for the state.

This effectively reverts e9bcc64e62 .
This commit is contained in:
Lucas Gabriel Vuotto 2024-06-10 17:44:05 +00:00
parent 666b833b98
commit 6677c6cab3
12 changed files with 44 additions and 104 deletions

View file

@ -209,12 +209,6 @@ chacha20_anycrypt(uint8_t *out, size_t *outlen, void *initparams,
return rc;
}
static void *
chacha20_ctx_new(void)
{
return malloc(sizeof(struct chacha20_ctx));
}
static struct lc_cipher_impl chacha20_impl = {
.encrypt_init = &chacha20_anycrypt_init,
@ -227,9 +221,7 @@ static struct lc_cipher_impl chacha20_impl = {
.decrypt_final = &chacha20_anycrypt_final,
.decrypt = &chacha20_anycrypt,
.ctx_new = &chacha20_ctx_new,
.ctx_free = NULL,
.argsz = sizeof(struct chacha20_ctx),
.blocklen = LC_CHACHA20_BLOCKLEN,
};
@ -244,9 +236,7 @@ static struct lc_cipher_impl xchacha20_impl = {
.decrypt_final = &chacha20_anycrypt_final,
.decrypt = &chacha20_anycrypt,
.ctx_new = &chacha20_ctx_new,
.ctx_free = NULL,
.argsz = sizeof(struct chacha20_ctx),
.blocklen = LC_XCHACHA20_BLOCKLEN,
};