mirror of
https://github.com/emmansun/gmsm.git
synced 2025-05-13 20:46:17 +08:00
internal/sm2ec: test point double 6 times
This commit is contained in:
parent
ebe5413d1e
commit
c50b71f0af
@ -3,6 +3,7 @@
|
|||||||
package sm2ec
|
package sm2ec
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"bytes"
|
||||||
"crypto/rand"
|
"crypto/rand"
|
||||||
"encoding/hex"
|
"encoding/hex"
|
||||||
"io"
|
"io"
|
||||||
@ -187,3 +188,19 @@ func BenchmarkP256SelectAffine(b *testing.B) {
|
|||||||
p256SelectAffine(&t0, &p256Precomputed[20], 20)
|
p256SelectAffine(&t0, &p256Precomputed[20], 20)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestPointDouble(t *testing.T) {
|
||||||
|
var double1, double2 SM2P256Point
|
||||||
|
p := NewSM2P256Point().SetGenerator()
|
||||||
|
p256PointDoubleAsm(&double1, p)
|
||||||
|
p256PointDoubleAsm(&double1, &double1)
|
||||||
|
p256PointDoubleAsm(&double1, &double1)
|
||||||
|
p256PointDoubleAsm(&double1, &double1)
|
||||||
|
p256PointDoubleAsm(&double1, &double1)
|
||||||
|
p256PointDoubleAsm(&double1, &double1)
|
||||||
|
|
||||||
|
p256PointDouble6TimesAsm(&double2, p)
|
||||||
|
if !bytes.Equal(double1.Bytes(), double2.Bytes()) {
|
||||||
|
t.Error("PointDouble6Times is incorrect")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user