crypto: aead - Use tmpl->create
authorHerbert Xu <herbert@gondor.apana.org.au>
Sat, 23 May 2015 07:41:49 +0000 (15:41 +0800)
committerHerbert Xu <herbert@gondor.apana.org.au>
Mon, 25 May 2015 10:41:29 +0000 (18:41 +0800)
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>
crypto/aead.c

index c1f73a9672a6072374ede3df0d7937b38ef95c88..a6385bd0e05000251f9656ab77c2eaa5a35e5722 100644 (file)
@@ -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;
 
This page took 0.040788 seconds and 5 git commands to generate.