Skip to content

Commit 6f1123f

Browse files
fjlceyonur
authored andcommitted
crypto: add IsOnCurve check (ethereum#31100)
1 parent 351da65 commit 6f1123f

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

crypto/crypto.go

Lines changed: 3 additions & 0 deletions
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)