summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHannes Reinecke <hare@suse.de>2022-06-27 11:51:57 +0200
committerJens Axboe <axboe@kernel.dk>2022-08-02 17:14:47 -0600
commite0af315c7b60bf5b1604089b363694f58cdf0cf1 (patch)
tree801d091a6225c05411a2eb983270a8876e03c0d2
parent922de3665750792ad48a89321d68daf5d267ef5a (diff)
downloadlinux-crypto-e0af315c7b60bf5b1604089b363694f58cdf0cf1.tar.gz
linux-crypto-e0af315c7b60bf5b1604089b363694f58cdf0cf1.zip
crypto: add crypto_has_shash()
Add helper function to determine if a given synchronous hash is supported. Signed-off-by: Hannes Reinecke <hare@suse.de> Reviewed-by: Sagi Grimberg <sagi@grimberg.me> Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com> Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com> Acked-by: Herbert Xu <herbert@gondor.apana.org.au> Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Jens Axboe <axboe@kernel.dk>
-rw-r--r--crypto/shash.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/crypto/shash.c b/crypto/shash.c
index 0a0a50cb..4c88e63b 100644
--- a/crypto/shash.c
+++ b/crypto/shash.c
@@ -521,6 +521,12 @@ struct crypto_shash *crypto_alloc_shash(const char *alg_name, u32 type,
}
EXPORT_SYMBOL_GPL(crypto_alloc_shash);
+int crypto_has_shash(const char *alg_name, u32 type, u32 mask)
+{
+ return crypto_type_has_alg(alg_name, &crypto_shash_type, type, mask);
+}
+EXPORT_SYMBOL_GPL(crypto_has_shash);
+
static int shash_prepare_alg(struct shash_alg *alg)
{
struct crypto_alg *base = &alg->base;