summaryrefslogtreecommitdiffstats
path: root/crypto/cfb.c
diff options
context:
space:
mode:
authorHerbert Xu <herbert@gondor.apana.org.au>2019-12-20 13:29:40 +0800
committerHerbert Xu <herbert@gondor.apana.org.au>2019-12-27 18:18:04 +0800
commitb3c16bfc6a79ae517ec3c44be615aed0ffa52c53 (patch)
tree1a0405808ed63f31289bee2ba5927cda3496e908 /crypto/cfb.c
parent93e23eb2ed6c11b4f483c8111ac155ec2b1f3042 (diff)
downloadlinux-b3c16bfc6a79ae517ec3c44be615aed0ffa52c53.tar.bz2
crypto: skcipher - Add skcipher_ialg_simple helper
This patch introduces the skcipher_ialg_simple helper which fetches the crypto_alg structure from a simple skcipher instance's spawn. This allows us to remove the third argument from the function skcipher_alloc_instance_simple. In doing so the reference count to the algorithm is now maintained by the Crypto API and the caller no longer needs to drop the alg refcount. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'crypto/cfb.c')
-rw-r--r--crypto/cfb.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/crypto/cfb.c b/crypto/cfb.c
index 7b68fbb61732..4e5219bbcd19 100644
--- a/crypto/cfb.c
+++ b/crypto/cfb.c
@@ -203,10 +203,12 @@ static int crypto_cfb_create(struct crypto_template *tmpl, struct rtattr **tb)
struct crypto_alg *alg;
int err;
- inst = skcipher_alloc_instance_simple(tmpl, tb, &alg);
+ inst = skcipher_alloc_instance_simple(tmpl, tb);
if (IS_ERR(inst))
return PTR_ERR(inst);
+ alg = skcipher_ialg_simple(inst);
+
/* CFB mode is a stream cipher. */
inst->alg.base.cra_blocksize = 1;
@@ -223,7 +225,6 @@ static int crypto_cfb_create(struct crypto_template *tmpl, struct rtattr **tb)
if (err)
inst->free(inst);
- crypto_mod_put(alg);
return err;
}