Skip to content

Commit 4b62543

Browse files
authored
Merge pull request #2256 from CortexFoundation/dev
crypto: add IsOnCurve check
2 parents 57cfa59 + 85dde7e commit 4b62543

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

0 commit comments

Comments
 (0)