summaryrefslogtreecommitdiff
path: root/crypto/ccm.c
diff options
context:
space:
mode:
authorEric Biggers <ebiggers@google.com>2020-01-02 20:04:38 -0800
committerHerbert Xu <herbert@gondor.apana.org.au>2020-01-09 11:30:57 +0800
commit5356607e443a5cb3e129fb1f0947bb400f95a64e (patch)
tree350a060a1ac4fabda53eccc606f25d938fa842f8 /crypto/ccm.c
parent1c7296029cbf6d99480a00965604da7e607467e4 (diff)
downloadlinux-crypto-5356607e443a5cb3e129fb1f0947bb400f95a64e.tar.gz
linux-crypto-5356607e443a5cb3e129fb1f0947bb400f95a64e.zip
crypto: shash - convert shash_free_instance() to new style
Convert shash_free_instance() and its users to the new way of freeing instances, where a ->free() method is installed to the instance struct itself. This replaces the weakly-typed method crypto_template::free(). This will allow removing support for the old way of freeing instances. Also give shash_free_instance() a more descriptive name to reflect that it's only for instances with a single spawn, not for any instance. Signed-off-by: Eric Biggers <ebiggers@google.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'crypto/ccm.c')
-rw-r--r--crypto/ccm.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/crypto/ccm.c b/crypto/ccm.c
index f4abaefd..241ecdc5 100644
--- a/crypto/ccm.c
+++ b/crypto/ccm.c
@@ -927,10 +927,12 @@ static int cbcmac_create(struct crypto_template *tmpl, struct rtattr **tb)
inst->alg.final = crypto_cbcmac_digest_final;
inst->alg.setkey = crypto_cbcmac_digest_setkey;
+ inst->free = shash_free_singlespawn_instance;
+
err = shash_register_instance(tmpl, inst);
if (err) {
err_free_inst:
- shash_free_instance(shash_crypto_instance(inst));
+ shash_free_singlespawn_instance(inst);
}
return err;
}
@@ -939,7 +941,6 @@ static struct crypto_template crypto_ccm_tmpls[] = {
{
.name = "cbcmac",
.create = cbcmac_create,
- .free = shash_free_instance,
.module = THIS_MODULE,
}, {
.name = "ccm_base",