diff --git a/sm9/bn256/gfp.go b/sm9/bn256/gfp.go index c427bbc..10291de 100644 --- a/sm9/bn256/gfp.go +++ b/sm9/bn256/gfp.go @@ -150,7 +150,7 @@ func (e *gfP) Unmarshal(in []byte) error { } func montEncode(c, a *gfP) { gfpMul(c, a, r2) } -func montDecode(c, a *gfP) { gfpMul(c, a, &gfP{1}) } +func montDecode(c, a *gfP) { gfpFromMont(c, a) } // cmovznzU64 is a single-word conditional move. // diff --git a/sm9/bn256/gfp_arm64.s b/sm9/bn256/gfp_arm64.s index dbf26ba..1324a85 100644 --- a/sm9/bn256/gfp_arm64.s +++ b/sm9/bn256/gfp_arm64.s @@ -660,7 +660,7 @@ TEXT ·gfpFromMont(SB),NOSPLIT,$0 ADCS t0, acc2, acc2 UMULH const3, hlp0, hlp0 - ADC $0, acc7 + ADC $0, hlp0 ADDS t1, acc0, acc0 ADCS y0, acc1, acc1