Skip to content

Commit

Permalink
crypto: aead - Use tmpl->create
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
herbertx committed May 25, 2015
1 parent 56e3437 commit 72af865
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions crypto/aead.c
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand All @@ -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;

Expand Down

0 comments on commit 72af865

Please sign in to comment.