From 032d7f64e8fedff98bccb78b43cd060719742a00 Mon Sep 17 00:00:00 2001 From: Filippo Valsorda Date: Mon, 28 Jan 2019 09:51:04 -0500 Subject: [PATCH] internal/group: set Z to 1, not 0 in FromAffine --- internal/group/ge.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/group/ge.go b/internal/group/ge.go index a428e76..91fb65f 100644 --- a/internal/group/ge.go +++ b/internal/group/ge.go @@ -171,7 +171,7 @@ type ProjectiveGroupElement struct { func (v *ProjectiveGroupElement) FromAffine(x, y *big.Int) *ProjectiveGroupElement { v.X.FromBig(x) v.Y.FromBig(y) - v.Z.Zero() + v.Z.One() return v } @@ -226,7 +226,7 @@ func (v *ProjectiveGroupElement) Zero() *ProjectiveGroupElement { func (v *ProjectiveGroupElement) DoubleZ1(u *ProjectiveGroupElement) *ProjectiveGroupElement { var B, C, D, E, F radix51.FieldElement - if u.Z.Equal(radix51.Zero) != 1 { + if u.Z.Equal(radix51.One) != 1 { panic("ed25519: DoubleZ1 called with Z != 1") }