Skip to content

Commit

Permalink
Merge pull request #25 from renproject/fix/xy-norm
Browse files Browse the repository at this point in the history
Return normalised point coordinates
  • Loading branch information
loongy committed May 3, 2021
2 parents c440883 + 80381e4 commit 8f6a009
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions point.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,15 @@ func (p *Point) XY() (Fp, Fp, error) {
var tmp C.secp256k1_ge

C.secp256k1_ge_set_gej(&tmp, &p.inner)
// Even though after the previous call `p` will represent the same curve
// point, the representation changes and can cause the x or y coordinates
// to be unnormalised. We therefore normalise the point which will also
// ensure that the returned xy coordinates are also normalised.
normalizeXYZ(&p.inner)
x.inner = tmp.x
y.inner = tmp.y
x.normalize()
y.normalize()
return x, y, nil
}

Expand Down

0 comments on commit 8f6a009

Please sign in to comment.