From 78254de2ee0805315fbbcf55f305b6ebb1241f89 Mon Sep 17 00:00:00 2001 From: daviyang35 Date: Wed, 25 Dec 2019 14:27:01 +0800 Subject: [PATCH 1/2] Fix sm9test_exch SKA verify error --- test/sm9test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/sm9test.c b/test/sm9test.c index 599f0f22..2ff3d8df 100644 --- a/test/sm9test.c +++ b/test/sm9test.c @@ -356,7 +356,7 @@ static int sm9test_exch(const char *idA, const char *idB) goto end; } - if (memcmp(SKA, SKA, sizeof(SKA)) != 0 || memcmp(SA, S2, sizeof(SA)) != 0) { + if (memcmp(SKA, SKB, sizeof(SKA)) != 0 || memcmp(SA, S2, sizeof(SA)) != 0) { goto end; } From 211b34e7b9e5764a19ffc9e8ba8da620755beba9 Mon Sep 17 00:00:00 2001 From: piggypiggy <18366460+piggypiggy@users.noreply.github.com> Date: Wed, 20 May 2020 00:12:26 +0800 Subject: [PATCH 2/2] sm2_bmi2_bugfix (#961) --- crypto/ec/asm/ecp_sm2z256-x86_64.pl | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/crypto/ec/asm/ecp_sm2z256-x86_64.pl b/crypto/ec/asm/ecp_sm2z256-x86_64.pl index 3e09a076..d3183e6e 100755 --- a/crypto/ec/asm/ecp_sm2z256-x86_64.pl +++ b/crypto/ec/asm/ecp_sm2z256-x86_64.pl @@ -1267,6 +1267,9 @@ __ecp_sm2z256_sqr_montx: shrx $a_ptr, $acc0, $t4 mov .Lpoly+8*3(%rip), $t1 + # set of = 0 + add \$0, $acc2 + # reduction step 1 xor $t1, $t1 adox $acc0, $acc1 @@ -1281,6 +1284,9 @@ __ecp_sm2z256_sqr_montx: shlx $a_ptr, $acc1, $t0 shrx $a_ptr, $acc1, $t4 + # set of = 0 + add \$0, $acc2 + # reduction step 2 adox $acc1, $acc2 adox $t1, $acc3 @@ -1294,6 +1300,9 @@ __ecp_sm2z256_sqr_montx: shlx $a_ptr, $acc2, $t0 shrx $a_ptr, $acc2, $t4 + # set of = 0 + add \$0, $acc2 + # reduction step 3 adox $acc2, $acc3 adox $t1, $acc0 @@ -1307,6 +1316,9 @@ __ecp_sm2z256_sqr_montx: shlx $a_ptr, $acc3, $t0 shrx $a_ptr, $acc3, $t4 + # set of = 0 + add \$0, $acc2 + # reduction step 4 adox $acc3, $acc0 adox $t1, $acc1