Open AnomalRoil opened 2 years ago
Currently, the Affine function is calling g.affine(p, p): https://github.com/kilic/bls12-381/blob/3a0f2553a3b9888a7201144592780f2300ad9ffb/g1.go#L336-L338
Affine
g.affine(p, p)
But then it changes the underlying point p, because of this Set: https://github.com/kilic/bls12-381/blob/3a0f2553a3b9888a7201144592780f2300ad9ffb/g1.go#L352-L355
p
Set
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.)
Currently, the
Affine
function is callingg.affine(p, p)
: https://github.com/kilic/bls12-381/blob/3a0f2553a3b9888a7201144592780f2300ad9ffb/g1.go#L336-L338But then it changes the underlying point
p
, because of thisSet
: https://github.com/kilic/bls12-381/blob/3a0f2553a3b9888a7201144592780f2300ad9ffb/g1.go#L352-L355This 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.)