bls12-381
bls12-381 copied to clipboard
`Affine(p *PointG1)` changes the underlying PointG1
Currently, the Affine
function is calling g.affine(p, p)
:
https://github.com/kilic/bls12-381/blob/3a0f2553a3b9888a7201144592780f2300ad9ffb/g1.go#L336-L338
But then it changes the underlying point p
, because of this Set
:
https://github.com/kilic/bls12-381/blob/3a0f2553a3b9888a7201144592780f2300ad9ffb/g1.go#L352-L355
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.)