aboutsummaryrefslogtreecommitdiff
path: root/include/crypto/internal/skcipher.h
diff options
context:
space:
mode:
authorHerbert Xu2019-12-20 13:29:40 +0800
committerHerbert Xu2019-12-27 18:18:04 +0800
commitb3c16bfc6a79ae517ec3c44be615aed0ffa52c53 (patch)
tree1a0405808ed63f31289bee2ba5927cda3496e908 /include/crypto/internal/skcipher.h
parent93e23eb2ed6c11b4f483c8111ac155ec2b1f3042 (diff)
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 'include/crypto/internal/skcipher.h')
-rw-r--r--include/crypto/internal/skcipher.h14
1 files changed, 11 insertions, 3 deletions
diff --git a/include/crypto/internal/skcipher.h b/include/crypto/internal/skcipher.h
index 921c409fe1b1..ad4a6330ff53 100644
--- a/include/crypto/internal/skcipher.h
+++ b/include/crypto/internal/skcipher.h
@@ -214,9 +214,17 @@ skcipher_cipher_simple(struct crypto_skcipher *tfm)
return ctx->cipher;
}
-struct skcipher_instance *
-skcipher_alloc_instance_simple(struct crypto_template *tmpl, struct rtattr **tb,
- struct crypto_alg **cipher_alg_ret);
+
+struct skcipher_instance *skcipher_alloc_instance_simple(
+ struct crypto_template *tmpl, struct rtattr **tb);
+
+static inline struct crypto_alg *skcipher_ialg_simple(
+ struct skcipher_instance *inst)
+{
+ struct crypto_spawn *spawn = skcipher_instance_ctx(inst);
+
+ return spawn->alg;
+}
#endif /* _CRYPTO_INTERNAL_SKCIPHER_H */