From 01bcddecfee31ea5131c681d60f548faecd80b7b Mon Sep 17 00:00:00 2001 From: Sun Yimin Date: Thu, 9 Oct 2025 11:13:58 +0800 Subject: [PATCH] =?UTF-8?q?Updated=20sm2=5Fz256=5Floong64.S=20=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=E5=88=86=E6=9E=90=20(markdown)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sm2_z256_loong64.S-代码分析.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/sm2_z256_loong64.S-代码分析.md b/sm2_z256_loong64.S-代码分析.md index f3d050c..33c009c 100644 --- a/sm2_z256_loong64.S-代码分析.md +++ b/sm2_z256_loong64.S-代码分析.md @@ -83,4 +83,9 @@ $T_3=T + T_2=(t_4+t_0-t_0>>32) \ast 2^{256}+(t_3 - t_0<<32) \ast 2^{192} + (t_2 **总体实现思路**: 1. 先完整计算出平方结果,用8个64位字表示,算完后再进行蒙哥马利约简计算。 -1. 最后,依然使用加`1`来实现`mod P`,这里的`1`为 $2^{256} - P$ 。 \ No newline at end of file +1. 最后,依然使用加`1`来实现`mod P`,这里的`1`为 $2^{256} - P$ 。 + +# 总结 +1. 进位、借位要格外小心、无进位判断要严谨。 +1. 使用加(或者减)`1`来实现`mod P`,这里的`1`为 $2^{256} - P$ 。 +1. 使用`masknez`和(或)`maskeqz`来选择最终结果。 \ No newline at end of file