Backport uadk engine patch(24-32) from linaro. Signed-off-by: Wenkai Lin <linwenkai6@hisilicon.com> (cherry picked from commit 9a48324e3f545ee8f8485847f3fecf252682eb6a)
63 lines
2.2 KiB
Diff
63 lines
2.2 KiB
Diff
From fe44bced638c7d3d3084f4e788478b2faa35ffa4 Mon Sep 17 00:00:00 2001
|
|
From: Zhiqi Song <songzhiqi1@huawei.com>
|
|
Date: Thu, 3 Mar 2022 02:53:01 +0000
|
|
Subject: [PATCH 27/31] v1: fixup about uninitialized variable
|
|
|
|
Fix the compile warning of uninitialized variable.
|
|
|
|
Signed-off-by: Zhiqi Song <songzhiqi1@huawei.com>
|
|
---
|
|
src/v1/alg/pkey/hpre_rsa.c | 12 ++++++++----
|
|
1 file changed, 8 insertions(+), 4 deletions(-)
|
|
|
|
diff --git a/src/v1/alg/pkey/hpre_rsa.c b/src/v1/alg/pkey/hpre_rsa.c
|
|
index 93ba99a..6c1d96d 100644
|
|
--- a/src/v1/alg/pkey/hpre_rsa.c
|
|
+++ b/src/v1/alg/pkey/hpre_rsa.c
|
|
@@ -316,7 +316,9 @@ static int hpre_rsa_public_encrypt(int flen, const unsigned char *from,
|
|
BIGNUM *ret_bn = NULL;
|
|
hpre_engine_ctx_t *eng_ctx = NULL;
|
|
unsigned char *in_buf = NULL;
|
|
- int key_bits, num_bytes;
|
|
+ BN_CTX *bn_ctx = NULL;
|
|
+ int num_bytes = 0;
|
|
+ int key_bits;
|
|
int ret;
|
|
|
|
if (hpre_rsa_check_para(flen, from, to, rsa) != HPRE_CRYPTO_SUCC)
|
|
@@ -340,7 +342,7 @@ static int hpre_rsa_public_encrypt(int flen, const unsigned char *from,
|
|
GOTOEND_IF(ret != HPRE_CRYPTO_SUCC, "check public key fail",
|
|
KAE_F_HPRE_RSA_PUBENC, KAE_R_PUBLIC_KEY_INVALID);
|
|
|
|
- BN_CTX *bn_ctx = BN_CTX_new();
|
|
+ bn_ctx = BN_CTX_new();
|
|
|
|
GOTOEND_IF(bn_ctx == NULL, "bn_ctx MALLOC FAILED!",
|
|
KAE_F_HPRE_RSA_PUBENC, KAE_R_MALLOC_FAILURE);
|
|
@@ -403,7 +405,9 @@ static int hpre_rsa_private_encrypt(int flen, const unsigned char *from,
|
|
const BIGNUM *dmq1 = (const BIGNUM *)NULL;
|
|
const BIGNUM *iqmp = (const BIGNUM *)NULL;
|
|
unsigned char *in_buf = (unsigned char *)NULL;
|
|
+ int num_bytes = 0;
|
|
int key_bits;
|
|
+ int version;
|
|
|
|
if (hpre_rsa_check_para(flen, from, to, rsa) != HPRE_CRYPTO_SUCC)
|
|
return HPRE_CRYPTO_FAIL;
|
|
@@ -431,10 +435,10 @@ static int hpre_rsa_private_encrypt(int flen, const unsigned char *from,
|
|
bn_ret = BN_CTX_get(bn_ctx);
|
|
RSA_get0_factors(rsa, &p, &q);
|
|
RSA_get0_crt_params(rsa, &dmp1, &dmq1, &iqmp);
|
|
- int version = RSA_get_version(rsa);
|
|
+ version = RSA_get_version(rsa);
|
|
|
|
RSA_get0_key(rsa, &n, &e, &d);
|
|
- int num_bytes = BN_num_bytes(n);
|
|
+ num_bytes = BN_num_bytes(n);
|
|
|
|
in_buf = (unsigned char *)OPENSSL_malloc(num_bytes);
|
|
GOTOEND_IF(bn_ret == NULL || in_buf == NULL, "OpenSSL malloc failure",
|
|
--
|
|
2.24.4
|
|
|