crypto: add IsOnCurve check (#31100)
This commit is contained in:
parent
7d0e197def
commit
fa9a2ff868
|
@ -178,6 +178,9 @@ func UnmarshalPubkey(pub []byte) (*ecdsa.PublicKey, error) {
|
||||||
if x == nil {
|
if x == nil {
|
||||||
return nil, errInvalidPubkey
|
return nil, errInvalidPubkey
|
||||||
}
|
}
|
||||||
|
if !S256().IsOnCurve(x, y) {
|
||||||
|
return nil, errInvalidPubkey
|
||||||
|
}
|
||||||
return &ecdsa.PublicKey{Curve: S256(), X: x, Y: y}, nil
|
return &ecdsa.PublicKey{Curve: S256(), X: x, Y: y}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue