diff options
author | Herbert Xu <herbert@gondor.apana.org.au> | 2015-07-09 07:17:17 +0800 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2015-07-14 14:56:45 +0800 |
commit | ba75e15fa0c4db489ed0d0a9745f904a7d5e19cc (patch) | |
tree | ab170889cc4cf0ba9befb40b1a9d5fe8101792e7 /crypto/aead.c | |
parent | 319382a6970899f02f18da4b0083a6e55942456d (diff) | |
download | op-kernel-dev-ba75e15fa0c4db489ed0d0a9745f904a7d5e19cc.zip op-kernel-dev-ba75e15fa0c4db489ed0d0a9745f904a7d5e19cc.tar.gz |
crypto: aead - Add type-safe function for freeing instances
This patch adds a type-safe function for freeing AEAD instances
to struct aead_instance. This replaces the existing free function
in struct crypto_template which does not know the type of the
instance that it's freeing.
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'crypto/aead.c')
-rw-r--r-- | crypto/aead.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/crypto/aead.c b/crypto/aead.c index 07bf997..8cd45a7 100644 --- a/crypto/aead.c +++ b/crypto/aead.c @@ -307,9 +307,22 @@ static void crypto_aead_show(struct seq_file *m, struct crypto_alg *alg) seq_printf(m, "geniv : <none>\n"); } +static void crypto_aead_free_instance(struct crypto_instance *inst) +{ + struct aead_instance *aead = aead_instance(inst); + + if (!aead->free) { + inst->tmpl->free(inst); + return; + } + + aead->free(aead); +} + static const struct crypto_type crypto_new_aead_type = { .extsize = crypto_alg_extsize, .init_tfm = crypto_aead_init_tfm, + .free = crypto_aead_free_instance, #ifdef CONFIG_PROC_FS .show = crypto_aead_show, #endif |