Skip to content

Commit

Permalink
clone points to avoid race condition in ValidatePairing
Browse files Browse the repository at this point in the history
  • Loading branch information
kevincharm committed Apr 3, 2024
1 parent 70a02ce commit 6d1a47b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pairing/bn254/suite.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,8 @@ func (s *Suite) Pair(p1 kyber.Point, p2 kyber.Point) kyber.Point {

// NB: Not safe for concurrent calls
func (s *Suite) ValidatePairing(p1, p2, inv1, inv2 kyber.Point) bool {
p2.(*pointG2).g.MakeAffine()
inv2.(*pointG2).g.MakeAffine()
p2.Clone().(*pointG2).g.MakeAffine()
inv2.Clone().(*pointG2).g.MakeAffine()
return s.Pair(p1, p2).Equal(s.Pair(inv1, inv2))
}

Expand Down

0 comments on commit 6d1a47b

Please sign in to comment.