summaryrefslogtreecommitdiffstats
path: root/crypto/aead.c
diff options
context:
space:
mode:
authorHerbert Xu <herbert@gondor.apana.org.au>2015-05-23 15:41:49 +0800
committerHerbert Xu <herbert@gondor.apana.org.au>2015-05-25 18:41:29 +0800
commit72af865d3413c319226b6ef5f6956b7f84980a4c (patch)
treef118418ba6419659f1723cd301121135d0918380 /crypto/aead.c
parent56e34378bbbb7af21cf73d98a92c0411386e091c (diff)
downloadlinux-72af865d3413c319226b6ef5f6956b7f84980a4c.tar.gz
linux-72af865d3413c319226b6ef5f6956b7f84980a4c.tar.bz2
linux-72af865d3413c319226b6ef5f6956b7f84980a4c.zip
crypto: aead - Use tmpl->create
Newer templates use tmpl->create and have a NULL tmpl->alloc. So we must use tmpl->create if it is set. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'crypto/aead.c')
-rw-r--r--crypto/aead.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/crypto/aead.c b/crypto/aead.c
index c1f73a9672a6..a6385bd0e050 100644
--- a/crypto/aead.c
+++ b/crypto/aead.c
@@ -572,6 +572,13 @@ static int crypto_nivaead_default(struct crypto_alg *alg, u32 type, u32 mask)
if (!tmpl)
goto kill_larval;
+ if (tmpl->create) {
+ err = tmpl->create(tmpl, tb);
+ if (err)
+ goto put_tmpl;
+ goto ok;
+ }
+
inst = tmpl->alloc(tb);
err = PTR_ERR(inst);
if (IS_ERR(inst))
@@ -583,6 +590,7 @@ static int crypto_nivaead_default(struct crypto_alg *alg, u32 type, u32 mask)
goto put_tmpl;
}
+ok:
/* Redo the lookup to use the instance we just registered. */
err = -EAGAIN;