mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-06-19 13:21:37 +00:00
Co-authored-by: fengjian <445077+fengjian@users.noreply.github.com>
This commit is contained in:
parent
2a96ecf87e
commit
f11cf2cce7
1 changed files with 3 additions and 0 deletions
|
|
@ -124,6 +124,9 @@ func (prv *PrivateKey) GenerateShared(pub *PublicKey, skLen, macLen int) (sk []b
|
|||
if prv.PublicKey.Curve != pub.Curve {
|
||||
return nil, ErrInvalidCurve
|
||||
}
|
||||
if pub.X == nil || pub.Y == nil || !pub.Curve.IsOnCurve(pub.X, pub.Y) {
|
||||
return nil, ErrInvalidPublicKey
|
||||
}
|
||||
if skLen+macLen > MaxSharedKeyLength(pub) {
|
||||
return nil, ErrSharedKeyTooBig
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue