}
func TestOnCurve(t *testing.T) {
+ t.Parallel()
testAllCurves(t, func(t *testing.T, curve Curve) {
if !curve.IsOnCurve(curve.Params().Gx, curve.Params().Gy) {
t.Error("basepoint is not on the curve")
}
func TestOffCurve(t *testing.T) {
+ t.Parallel()
testAllCurves(t, func(t *testing.T, curve Curve) {
x, y := new(big.Int).SetInt64(1), new(big.Int).SetInt64(1)
if curve.IsOnCurve(x, y) {
}
func TestInfinity(t *testing.T) {
+ t.Parallel()
testAllCurves(t, testInfinity)
}
}
func TestMarshal(t *testing.T) {
+ t.Parallel()
testAllCurves(t, func(t *testing.T, curve Curve) {
_, x, y, err := GenerateKey(curve, rand.Reader)
if err != nil {
}
func TestUnmarshalToLargeCoordinates(t *testing.T) {
+ t.Parallel()
// See https://golang.org/issues/20482.
testAllCurves(t, testUnmarshalToLargeCoordinates)
}
// (negative or bigger than P). They are expected to return false from
// IsOnCurve, all other behavior is undefined.
func TestInvalidCoordinates(t *testing.T) {
+ t.Parallel()
testAllCurves(t, testInvalidCoordinates)
}
}
func TestMarshalCompressed(t *testing.T) {
+ t.Parallel()
t.Run("P-256/03", func(t *testing.T) {
data, _ := hex.DecodeString("031e3987d9f9ea9d7dd7155a56a86b2009e1e0ab332f962d10d8beb6406ab1ad79")
x, _ := new(big.Int).SetString("13671033352574878777044637384712060483119675368076128232297328793087057702265", 10)
}
func TestLargeIsOnCurve(t *testing.T) {
+ t.Parallel()
testAllCurves(t, func(t *testing.T, curve Curve) {
large := big.NewInt(1)
large.Lsh(large, 1000)