Skip to content

Commit 85cc424

Browse files
hreineckeaxboe
authored andcommitted
crypto: add crypto_has_shash()
Add helper function to determine if a given synchronous hash is supported. Signed-off-by: Hannes Reinecke <[email protected]> Reviewed-by: Sagi Grimberg <[email protected]> Reviewed-by: Chaitanya Kulkarni <[email protected]> Reviewed-by: Himanshu Madhani <[email protected]> Acked-by: Herbert Xu <[email protected]> Signed-off-by: Christoph Hellwig <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
1 parent e41f8c0 commit 85cc424

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

crypto/shash.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -521,6 +521,12 @@ struct crypto_shash *crypto_alloc_shash(const char *alg_name, u32 type,
521521
}
522522
EXPORT_SYMBOL_GPL(crypto_alloc_shash);
523523

524+
int crypto_has_shash(const char *alg_name, u32 type, u32 mask)
525+
{
526+
return crypto_type_has_alg(alg_name, &crypto_shash_type, type, mask);
527+
}
528+
EXPORT_SYMBOL_GPL(crypto_has_shash);
529+
524530
static int shash_prepare_alg(struct shash_alg *alg)
525531
{
526532
struct crypto_alg *base = &alg->base;

include/crypto/hash.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -718,6 +718,8 @@ static inline void ahash_request_set_crypt(struct ahash_request *req,
718718
struct crypto_shash *crypto_alloc_shash(const char *alg_name, u32 type,
719719
u32 mask);
720720

721+
int crypto_has_shash(const char *alg_name, u32 type, u32 mask);
722+
721723
static inline struct crypto_tfm *crypto_shash_tfm(struct crypto_shash *tfm)
722724
{
723725
return &tfm->base;

0 commit comments

Comments
 (0)