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] 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