mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-06-20 13:44:31 +00:00
crypto: add IsOnCurve check (#31100)
This commit is contained in:
parent
7688f988c2
commit
955616d7c2
1 changed files with 3 additions and 0 deletions
|
|
@ -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
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue