Skip to content

Commit 0af2bb4

Browse files
fjlqdm12
authored andcommitted
crypto: add IsOnCurve check (ethereum#31100)
1 parent 77b952f commit 0af2bb4

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

crypto/crypto.go

+3
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,9 @@ func UnmarshalPubkey(pub []byte) (*ecdsa.PublicKey, error) {
169169
if x == nil {
170170
return nil, errInvalidPubkey
171171
}
172+
if !S256().IsOnCurve(x, y) {
173+
return nil, errInvalidPubkey
174+
}
172175
return &ecdsa.PublicKey{Curve: S256(), X: x, Y: y}, nil
173176
}
174177

0 commit comments

Comments
 (0)