From 282f78fc44dc216166ae463944d952f753f7c8b6 Mon Sep 17 00:00:00 2001
From: Kai Ye <yekai13@huawei.com>
Date: Sat, 23 Jul 2022 10:49:04 +0800
Subject: [PATCH 178/183] uadk: add wd_<alg>_get_msg()

Add wd_<alg>_get_msg() for driver to obtain the sent
message by the user.

Signed-off-by: Kai Ye <yekai13@huawei.com>
Signed-off-by: Weili Qian <qianweili@huawei.com>
---
 include/drv/wd_dh_drv.h  | 1 +
 include/drv/wd_ecc_drv.h | 1 +
 include/drv/wd_rsa_drv.h | 1 +
 wd_dh.c                  | 5 +++++
 wd_ecc.c                 | 5 +++++
 wd_rsa.c                 | 5 +++++
 6 files changed, 18 insertions(+)

diff --git a/include/drv/wd_dh_drv.h b/include/drv/wd_dh_drv.h
index f8e3065..57f774d 100644
--- a/include/drv/wd_dh_drv.h
+++ b/include/drv/wd_dh_drv.h
@@ -36,6 +36,7 @@ struct wd_dh_driver {
 
 void wd_dh_set_driver(struct wd_dh_driver *drv);
 struct wd_dh_driver *wd_dh_get_driver(void);
+struct wd_dh_msg *wd_dh_get_msg(__u32 idx, __u32 tag);
 
 #ifdef WD_STATIC_DRV
 #define WD_DH_SET_DRIVER(drv)						\
diff --git a/include/drv/wd_ecc_drv.h b/include/drv/wd_ecc_drv.h
index 857da20..ddf5e5b 100644
--- a/include/drv/wd_ecc_drv.h
+++ b/include/drv/wd_ecc_drv.h
@@ -188,6 +188,7 @@ struct wd_ecc_driver {
 
 void wd_ecc_set_driver(struct wd_ecc_driver *drv);
 struct wd_ecc_driver *wd_ecc_get_driver(void);
+struct wd_ecc_msg *wd_ecc_get_msg(__u32 idx, __u32 tag);
 
 #ifdef WD_STATIC_DRV
 #define WD_ECC_SET_DRIVER(drv)						\
diff --git a/include/drv/wd_rsa_drv.h b/include/drv/wd_rsa_drv.h
index 83f1af2..108c2a3 100644
--- a/include/drv/wd_rsa_drv.h
+++ b/include/drv/wd_rsa_drv.h
@@ -61,6 +61,7 @@ struct wd_rsa_driver {
 
 void wd_rsa_set_driver(struct wd_rsa_driver *drv);
 struct wd_rsa_driver *wd_rsa_get_driver(void);
+struct wd_rsa_msg *wd_rsa_get_msg(__u32 idx, __u32 tag);
 
 #ifdef WD_STATIC_DRV
 #define WD_RSA_SET_DRIVER(drv)						      \
diff --git a/wd_dh.c b/wd_dh.c
index 41c4a2a..0bf770d 100644
--- a/wd_dh.c
+++ b/wd_dh.c
@@ -290,6 +290,11 @@ fail_with_msg:
 	return ret;
 }
 
+struct wd_dh_msg *wd_dh_get_msg(__u32 idx, __u32 tag)
+{
+	return wd_find_msg_in_pool(&wd_dh_setting.pool, idx, tag);
+}
+
 int wd_dh_poll_ctx(__u32 idx, __u32 expt, __u32 *count)
 {
 	struct wd_ctx_config_internal *config = &wd_dh_setting.config;
diff --git a/wd_ecc.c b/wd_ecc.c
index 136e8e2..2266b1d 100644
--- a/wd_ecc.c
+++ b/wd_ecc.c
@@ -2119,6 +2119,11 @@ fail_with_msg:
 	return ret;
 }
 
+struct wd_ecc_msg *wd_ecc_get_msg(__u32 idx, __u32 tag)
+{
+	return wd_find_msg_in_pool(&wd_ecc_setting.pool, idx, tag);
+}
+
 int wd_ecc_poll_ctx(__u32 idx, __u32 expt, __u32 *count)
 {
 	struct wd_ctx_config_internal *config = &wd_ecc_setting.config;
diff --git a/wd_rsa.c b/wd_rsa.c
index fb2b6b0..489833e 100644
--- a/wd_rsa.c
+++ b/wd_rsa.c
@@ -349,6 +349,11 @@ fail_with_msg:
 	return ret;
 }
 
+struct wd_rsa_msg *wd_rsa_get_msg(__u32 idx, __u32 tag)
+{
+	return wd_find_msg_in_pool(&wd_rsa_setting.pool, idx, tag);
+}
+
 int wd_rsa_poll_ctx(__u32 idx, __u32 expt, __u32 *count)
 {
 	struct wd_ctx_config_internal *config = &wd_rsa_setting.config;
-- 
2.27.0

