From aef77e54abbe10cef4fcfb4442311aea3d065746 Mon Sep 17 00:00:00 2001 From: Gorachya <38173958+Gorachya@users.noreply.github.com> Date: Mon, 22 Aug 2022 16:24:07 +0800 Subject: [PATCH 1/3] Update sm9_lib.c --- src/sm9_lib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sm9_lib.c b/src/sm9_lib.c index 26976a2f..cf96e705 100644 --- a/src/sm9_lib.c +++ b/src/sm9_lib.c @@ -216,7 +216,7 @@ int sm9_do_verify(const SM9_SIGN_MASTER_KEY *mpk, const char *id, size_t idlen, // B6: P = h1 * P2 + Ppubs sm9_twist_point_mul_generator(&P, h1); - sm9_twist_point_add(&P, &P, &mpk->Ppubs); + sm9_twist_point_add_full(&P, &P, &mpk->Ppubs); // B7: u = e(S, P) sm9_pairing(u, &P, &sig->S); From 495a5c731a1c58cb4fb6a90ee895a7619e950167 Mon Sep 17 00:00:00 2001 From: Gorachya <38173958+Gorachya@users.noreply.github.com> Date: Mon, 22 Aug 2022 16:24:52 +0800 Subject: [PATCH 2/3] Update sm9test.c --- tests/sm9test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/sm9test.c b/tests/sm9test.c index 43577e45..68c1e3b5 100644 --- a/tests/sm9test.c +++ b/tests/sm9test.c @@ -540,7 +540,7 @@ int test_sm9_sign() { sm9_verify_init(&ctx); sm9_verify_update(&ctx, data, sizeof(data)); - if (sm9_verify_finish(&ctx, sig, siglen, &mpk, (char *)IDA, sizeof(IDA)) < 0) goto err; ++j; + if (sm9_verify_finish(&ctx, sig, siglen, &mpk, (char *)IDA, sizeof(IDA)) <= 0) goto err; ++j; printf("%s() ok\n", __FUNCTION__); return 1; From 221007439b4ec2adfedd1cb9b269dcb04d0b9e76 Mon Sep 17 00:00:00 2001 From: Gorachya <38173958+Gorachya@users.noreply.github.com> Date: Mon, 22 Aug 2022 16:30:47 +0800 Subject: [PATCH 3/3] Update sm9test.c --- tests/sm9test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/sm9test.c b/tests/sm9test.c index 68c1e3b5..dabbae9f 100644 --- a/tests/sm9test.c +++ b/tests/sm9test.c @@ -540,7 +540,7 @@ int test_sm9_sign() { sm9_verify_init(&ctx); sm9_verify_update(&ctx, data, sizeof(data)); - if (sm9_verify_finish(&ctx, sig, siglen, &mpk, (char *)IDA, sizeof(IDA)) <= 0) goto err; ++j; + if (sm9_verify_finish(&ctx, sig, siglen, &mpk, (char *)IDA, sizeof(IDA)) != 1) goto err; ++j; printf("%s() ok\n", __FUNCTION__); return 1;