Skip to content
This repository has been archived by the owner on Dec 27, 2023. It is now read-only.

Affine(p *PointG1) changes the underlying PointG1 #37

Open
AnomalRoil opened this issue Aug 23, 2022 · 0 comments
Open

Affine(p *PointG1) changes the underlying PointG1 #37

AnomalRoil opened this issue Aug 23, 2022 · 0 comments

Comments

@AnomalRoil
Copy link

Currently, the Affine function is calling g.affine(p, p):

bls12-381/g1.go

Lines 336 to 338 in 3a0f255

func (g *G1) Affine(p *PointG1) *PointG1 {
return g.affine(p, p)
}

But then it changes the underlying point p, because of this Set:

bls12-381/g1.go

Lines 352 to 355 in 3a0f255

} else {
r.Set(p)
}
return r

This is unexpected from a function that's supposed to return an affine representation, since it actually mutates the point (and can cause nasty race conditions in code assuming the Affine is really just a getter and not a setter.)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant