Skip to content

Commit

Permalink
crypto/secp256r1: reject the reference pubKey coordinates
Browse files Browse the repository at this point in the history
(cherry picked from commit 98f10b0d5e358075d03b76834cd30c97f4fbdfe1)
  • Loading branch information
ulerdogan authored and anshalshukla committed Nov 3, 2023
1 parent 2bbf30f commit ab2f20e
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions crypto/secp256r1/publickey.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ func newPublicKey(x, y *big.Int) *ecdsa.PublicKey {
return nil
}

// Check if the given coordinates are the reference point (infinity)
if x.Sign() == 0 && y.Sign() == 0 {
return nil
}

return &ecdsa.PublicKey{
Curve: elliptic.P256(),
X: x,
Expand Down

0 comments on commit ab2f20e

Please sign in to comment.