uadk_engine/0053-rsa-remove-unused-software-method.patch
Yang Shen dccd1cb407 uadk_engine - update uadk engine source
Update some patch for uadk_engine from mainline.

Signed-off-by: Yang Shen <shenyang39@huawei.com>
(cherry picked from commit 6ae4d8c0999343eddb153c4e4e879a6b66ef528f)
2022-09-27 09:37:59 +08:00

98 lines
2.6 KiB
Diff

From ff703a9aa6a0a2dada51b7bf88cc9e1a8ce2d6cd Mon Sep 17 00:00:00 2001
From: Zhiqi Song <songzhiqi1@huawei.com>
Date: Sat, 23 Jul 2022 17:16:59 +0800
Subject: [PATCH 53/57] rsa: remove unused software method
Switching to software methods in abnormal scenarios has been
implemented in other functions, uadk_e_get_rsa_sw_methods()
is actually unused, so we remove it.
Signed-off-by: Zhiqi Song <songzhiqi1@huawei.com>
---
src/uadk_rsa.c | 49 +++++--------------------------------------------
1 file changed, 5 insertions(+), 44 deletions(-)
diff --git a/src/uadk_rsa.c b/src/uadk_rsa.c
index 5b23dab..7983bc0 100644
--- a/src/uadk_rsa.c
+++ b/src/uadk_rsa.c
@@ -53,7 +53,6 @@
#define ENV_ENABLED 1
static RSA_METHOD *rsa_hw_meth;
-static RSA_METHOD *rsa_sw_meth;
struct bignum_st {
BN_ULONG *d;
@@ -1737,25 +1736,11 @@ exe_soft:
(flen, from, to, rsa, padding);
}
-static RSA_METHOD *uadk_e_get_rsa_sw_methods(void)
-{
- /* meth: default rsa software method */
- const RSA_METHOD *meth = RSA_PKCS1_OpenSSL();
-
- rsa_sw_meth = RSA_meth_new("rsa soft method", 0);
- (void)RSA_meth_set_pub_enc(rsa_sw_meth, RSA_meth_get_pub_enc(meth));
- (void)RSA_meth_set_priv_enc(rsa_sw_meth, RSA_meth_get_priv_enc(meth));
- (void)RSA_meth_set_pub_dec(rsa_sw_meth, RSA_meth_get_pub_dec(meth));
- (void)RSA_meth_set_priv_dec(rsa_sw_meth, RSA_meth_get_priv_dec(meth));
- (void)RSA_meth_set_keygen(rsa_sw_meth, uadk_e_soft_rsa_keygen);
- (void)RSA_meth_set_mod_exp(rsa_sw_meth, RSA_meth_get_mod_exp(meth));
- (void)RSA_meth_set_bn_mod_exp(rsa_sw_meth,
- RSA_meth_get_bn_mod_exp(meth));
-
- return rsa_sw_meth;
-}
-
-static RSA_METHOD *uadk_e_get_rsa_hw_methods(void)
+/**
+ * uadk_get_rsa_method() - Set rsa hardware methods of the RSA implementation which
+ * can be called from ENGINE structure.
+ */
+static RSA_METHOD *uadk_e_get_rsa_methods(void)
{
if (rsa_hw_meth)
return rsa_hw_meth;
@@ -1780,36 +1765,12 @@ static RSA_METHOD *uadk_e_get_rsa_hw_methods(void)
return rsa_hw_meth;
}
-/**
- * uadk_get_rsa_method() - Set rsa methods of the RSA implementation which
- * can be called from ENGINE structure.
- */
-static RSA_METHOD *uadk_e_get_rsa_methods(void)
-{
- struct uacce_dev *dev;
-
- dev = wd_get_accel_dev("rsa");
- if (!dev)
- return uadk_e_get_rsa_sw_methods();
-
- free(dev);
- return uadk_e_get_rsa_hw_methods();
-}
-
static void uadk_e_delete_rsa_meth(void)
{
- if (!rsa_hw_meth && !rsa_sw_meth)
- return;
-
if (rsa_hw_meth) {
RSA_meth_free(rsa_hw_meth);
rsa_hw_meth = NULL;
}
-
- if (rsa_sw_meth) {
- RSA_meth_free(rsa_sw_meth);
- rsa_sw_meth = NULL;
- }
}
/**
--
2.27.0