crypto: add IsOnCurve check (#31100)

This commit is contained in:
Felix Lange 2025-01-30 14:10:36 +01:00 committed by Daniel Liu
parent f7c46d0ad7
commit 98ad241607

View file

@ -178,6 +178,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
}