From acb50a08d888183c7e31cfdd72401d59da8ec756 Mon Sep 17 00:00:00 2001 From: Wendal Chen Date: Sat, 4 Mar 2023 12:39:25 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20sm2=5Fpoint=5Ffrom=5Fx=E5=87=BD=E6=95=B0?= =?UTF-8?q?=E5=86=85=E7=9A=84=E8=A1=A8=E8=BE=BE=E5=BC=8F=E5=BA=94=E8=AF=A5?= =?UTF-8?q?=E6=98=8E=E7=A1=AE=E4=BC=98=E5=85=88=E7=BA=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ```` if ((y == 0x02 && sm2_bn_is_odd(_y)) || (y == 0x03) && !sm2_bn_is_odd(_y)) { ``` 后半段的优先级应该加括号包起来 --- src/sm2_alg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sm2_alg.c b/src/sm2_alg.c index 1865eaf4..4eb24fad 100644 --- a/src/sm2_alg.c +++ b/src/sm2_alg.c @@ -1115,7 +1115,7 @@ int sm2_point_from_x(SM2_POINT *P, const uint8_t x[32], int y) return -1; } - if ((y == 0x02 && sm2_bn_is_odd(_y)) || (y == 0x03) && !sm2_bn_is_odd(_y)) { + if ((y == 0x02 && sm2_bn_is_odd(_y)) || ((y == 0x03) && !sm2_bn_is_odd(_y))) { sm2_fp_neg(_y, _y); }