summaryrefslogtreecommitdiff
path: root/crypto/echainiv.c
diff options
context:
space:
mode:
authorEric Biggers <ebiggers@google.com>2020-01-02 20:04:36 -0800
committerHerbert Xu <herbert@gondor.apana.org.au>2020-01-09 11:30:57 +0800
commit0e21969f566023ce3afcf3a73edbb8960be9fa54 (patch)
tree64ed961a1170d6c102adffb4af2235000dc2bc9c /crypto/echainiv.c
parentc2515d57afc37b73dbdec2417cd2fbbcf2e34c2b (diff)
downloadlinux-crypto-0e21969f566023ce3afcf3a73edbb8960be9fa54.tar.gz
linux-crypto-0e21969f566023ce3afcf3a73edbb8960be9fa54.zip
crypto: geniv - convert to new way of freeing instances
Convert the "seqiv" template to the new way of freeing instances where a ->free() method is installed to the instance struct itself. Also remove the unused implementation of the old way of freeing instances from the "echainiv" template, since it's already using the new way too. In doing this, also simplify the code by making the helper function aead_geniv_alloc() install the ->free() method, instead of making seqiv and echainiv do this themselves. This is analogous to how skcipher_alloc_instance_simple() works. This will allow removing support for the old way of freeing instances. Signed-off-by: Eric Biggers <ebiggers@google.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'crypto/echainiv.c')
-rw-r--r--crypto/echainiv.c20
1 files changed, 4 insertions, 16 deletions
diff --git a/crypto/echainiv.c b/crypto/echainiv.c
index a49cbf7b..4a2f02ba 100644
--- a/crypto/echainiv.c
+++ b/crypto/echainiv.c
@@ -133,29 +133,17 @@ static int echainiv_aead_create(struct crypto_template *tmpl,
inst->alg.base.cra_ctxsize = sizeof(struct aead_geniv_ctx);
inst->alg.base.cra_ctxsize += inst->alg.ivsize;
- inst->free = aead_geniv_free;
-
err = aead_register_instance(tmpl, inst);
- if (err)
- goto free_inst;
-
-out:
- return err;
-
+ if (err) {
free_inst:
- aead_geniv_free(inst);
- goto out;
-}
-
-static void echainiv_free(struct crypto_instance *inst)
-{
- aead_geniv_free(aead_instance(inst));
+ inst->free(inst);
+ }
+ return err;
}
static struct crypto_template echainiv_tmpl = {
.name = "echainiv",
.create = echainiv_aead_create,
- .free = echainiv_free,
.module = THIS_MODULE,
};