diff mbox series

[02/12] crypto: add crypto_has_kpp()

Message ID 20211112125928.97318-3-hare@suse.de (mailing list archive)
State Not Applicable
Delegated to: Herbert Xu
Headers show
Series nvme: In-band authentication support | expand

Commit Message

Hannes Reinecke Nov. 12, 2021, 12:59 p.m. UTC
Add helper function to determine if a given key-agreement protocol
primitive is supported.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>
---
 crypto/kpp.c         | 6 ++++++
 include/crypto/kpp.h | 2 ++
 2 files changed, 8 insertions(+)

Comments

Himanshu Madhani Nov. 15, 2021, 3:19 p.m. UTC | #1
On 11/12/21 06:59, Hannes Reinecke wrote:
> Add helper function to determine if a given key-agreement protocol
> primitive is supported.
> 
> Signed-off-by: Hannes Reinecke <hare@suse.de>
> Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
> Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>
> ---
>   crypto/kpp.c         | 6 ++++++
>   include/crypto/kpp.h | 2 ++
>   2 files changed, 8 insertions(+)
> 
> diff --git a/crypto/kpp.c b/crypto/kpp.c
> index 313b2c699963..416e8a1a03ee 100644
> --- a/crypto/kpp.c
> +++ b/crypto/kpp.c
> @@ -87,6 +87,12 @@ struct crypto_kpp *crypto_alloc_kpp(const char *alg_name, u32 type, u32 mask)
>   }
>   EXPORT_SYMBOL_GPL(crypto_alloc_kpp);
>   
> +int crypto_has_kpp(const char *alg_name, u32 type, u32 mask)
> +{
> +	return crypto_type_has_alg(alg_name, &crypto_kpp_type, type, mask);
> +}
> +EXPORT_SYMBOL_GPL(crypto_has_kpp);
> +
>   static void kpp_prepare_alg(struct kpp_alg *alg)
>   {
>   	struct crypto_alg *base = &alg->base;
> diff --git a/include/crypto/kpp.h b/include/crypto/kpp.h
> index cccceadc164b..24d01e9877c1 100644
> --- a/include/crypto/kpp.h
> +++ b/include/crypto/kpp.h
> @@ -104,6 +104,8 @@ struct kpp_alg {
>    */
>   struct crypto_kpp *crypto_alloc_kpp(const char *alg_name, u32 type, u32 mask);
>   
> +int crypto_has_kpp(const char *alg_name, u32 type, u32 mask);
> +
>   static inline struct crypto_tfm *crypto_kpp_tfm(struct crypto_kpp *tfm)
>   {
>   	return &tfm->base;
> 

Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
diff mbox series

Patch

diff --git a/crypto/kpp.c b/crypto/kpp.c
index 313b2c699963..416e8a1a03ee 100644
--- a/crypto/kpp.c
+++ b/crypto/kpp.c
@@ -87,6 +87,12 @@  struct crypto_kpp *crypto_alloc_kpp(const char *alg_name, u32 type, u32 mask)
 }
 EXPORT_SYMBOL_GPL(crypto_alloc_kpp);
 
+int crypto_has_kpp(const char *alg_name, u32 type, u32 mask)
+{
+	return crypto_type_has_alg(alg_name, &crypto_kpp_type, type, mask);
+}
+EXPORT_SYMBOL_GPL(crypto_has_kpp);
+
 static void kpp_prepare_alg(struct kpp_alg *alg)
 {
 	struct crypto_alg *base = &alg->base;
diff --git a/include/crypto/kpp.h b/include/crypto/kpp.h
index cccceadc164b..24d01e9877c1 100644
--- a/include/crypto/kpp.h
+++ b/include/crypto/kpp.h
@@ -104,6 +104,8 @@  struct kpp_alg {
  */
 struct crypto_kpp *crypto_alloc_kpp(const char *alg_name, u32 type, u32 mask);
 
+int crypto_has_kpp(const char *alg_name, u32 type, u32 mask);
+
 static inline struct crypto_tfm *crypto_kpp_tfm(struct crypto_kpp *tfm)
 {
 	return &tfm->base;