Skip to content

Commit 159fb1a

Browse files
committed
crypto: add IsOnCurve check (#31100)
1 parent db93d49 commit 159fb1a

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
@@ -178,6 +178,9 @@ func UnmarshalPubkey(pub []byte) (*ecdsa.PublicKey, error) {
178178
if x == nil {
179179
return nil, errInvalidPubkey
180180
}
181+
if !S256().IsOnCurve(x, y) {
182+
return nil, errInvalidPubkey
183+
}
181184
return &ecdsa.PublicKey{Curve: S256(), X: x, Y: y}, nil
182185
}
183186

0 commit comments

Comments
 (0)