crypto: add IsOnCurve check (#31100)

This commit is contained in:
Felix Lange 2025-01-30 14:10:36 +01:00 committed by Arran Schlosberg
parent 7688f988c2
commit 955616d7c2
No known key found for this signature in database
GPG key ID: 5DD5567C12C5F312

View file

@ -169,6 +169,9 @@ func UnmarshalPubkey(pub []byte) (*ecdsa.PublicKey, error) {
if x == nil {
return nil, errInvalidPubkey
}
if !S256().IsOnCurve(x, y) {
return nil, errInvalidPubkey
}
return &ecdsa.PublicKey{Curve: S256(), X: x, Y: y}, nil
}