internal/sm2ec: loong64 test p256PointAddAsm

This commit is contained in:
Sun Yimin 2025-10-15 16:21:54 +08:00 committed by GitHub
parent 8bb8364b43
commit ed43a82f8f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -205,13 +205,21 @@ func TestPointDouble(t *testing.T) {
}
if hex.EncodeToString(double1.Bytes()) != "0497662389f36ce643a47dcf644f700651e988794843797b0c4a69c806e78615c2cd4d9449aea5cac5328b8d67d4ae956f5eb06c4515ff01bd17eef58bf866b33f" {
t.Errorf("PointDouble6Times is incorrect %x", double1.Bytes())
t.Errorf("PointDouble6Times 1 is incorrect %x", double1.Bytes())
}
if hex.EncodeToString(double2.Bytes()) != "0497662389f36ce643a47dcf644f700651e988794843797b0c4a69c806e78615c2cd4d9449aea5cac5328b8d67d4ae956f5eb06c4515ff01bd17eef58bf866b33f" {
t.Errorf("PointDouble6Times 2 is incorrect %x", double2.Bytes())
}
}
func TestPointAdd(t *testing.T) {
p := NewSM2P256Point().SetGenerator()
var p1, p2, sum1, sum2 SM2P256Point
ret := p256PointAddAsm(&sum1, p, p)
if ret != 1 {
t.Error("Should return 1")
}
p256PointDoubleAsm(&p1, p)
p256PointAddAsm(&sum1, p, &p1)