From 91d11133e1f6d79e38da014123ddd0b0dc132be6 Mon Sep 17 00:00:00 2001
From: Wenkai Lin <linwenkai6@hisilicon.com>
Date: Sun, 24 Apr 2022 09:54:24 +0800
Subject: [PATCH 119/183] uadk: ecc: fix local variable referenced in macro

REGULAR_LEN is is calculated by multiplying the key length
by the constant parameter num, use CURVE_PARAM_NUM is better.

Signed-off-by: Wenkai Lin <linwenkai6@hisilicon.com>
---
 v1/wd_ecc.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/v1/wd_ecc.c b/v1/wd_ecc.c
index 2358243..e2837bd 100644
--- a/v1/wd_ecc.c
+++ b/v1/wd_ecc.c
@@ -1822,9 +1822,8 @@ static int sm2_compute_za_hash(__u8 *za, __u32 *len, struct wd_dtb *id,
 		id_bytes = id->dsize;
 	}
 
-#define REGULAR_LENS	(6 * key_size) /* a b xG yG xA yA */
 	/* ZA = h(ENTL || ID || a || b || xG || yG || xA || yA) */
-	lens = sizeof(__u16) + id_bytes + REGULAR_LENS;
+	lens = sizeof(__u16) + id_bytes + CURVE_PARAM_NUM * key_size;
 	p_in = malloc(lens);
 	if (unlikely(!p_in))
 		return -WD_ENOMEM;
-- 
2.27.0

