mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-24 21:56:43 +00:00
p2p: fix RLPx nits
This commit is contained in:
parent
88b6d12057
commit
0b84e3224f
1 changed files with 2 additions and 2 deletions
|
|
@ -256,7 +256,7 @@ func (h *encHandshake) secrets(auth, authResp []byte) (secrets, error) {
|
||||||
return s, nil
|
return s, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// ecdhShared returns the static shared secret, the result
|
// staticSharedSecret returns the static shared secret, the result
|
||||||
// of key agreement between the local and remote static node key.
|
// of key agreement between the local and remote static node key.
|
||||||
func (h *encHandshake) staticSharedSecret(prv *ecdsa.PrivateKey) ([]byte, error) {
|
func (h *encHandshake) staticSharedSecret(prv *ecdsa.PrivateKey) ([]byte, error) {
|
||||||
return ecies.ImportECDSA(prv).GenerateShared(h.remotePub, sskLen, sskLen)
|
return ecies.ImportECDSA(prv).GenerateShared(h.remotePub, sskLen, sskLen)
|
||||||
|
|
@ -490,7 +490,7 @@ func readHandshakeMsg(msg plainDecoder, plainSize int, prv *ecdsa.PrivateKey, r
|
||||||
prefix := buf[:2]
|
prefix := buf[:2]
|
||||||
size := binary.BigEndian.Uint16(prefix)
|
size := binary.BigEndian.Uint16(prefix)
|
||||||
if size < uint16(plainSize) {
|
if size < uint16(plainSize) {
|
||||||
return buf, fmt.Errorf("size underflow, need at least ~d bytes", plainSize)
|
return buf, fmt.Errorf("size underflow, need at least %d bytes", plainSize)
|
||||||
}
|
}
|
||||||
buf = append(buf, make([]byte, size-uint16(plainSize)+2)...)
|
buf = append(buf, make([]byte, size-uint16(plainSize)+2)...)
|
||||||
if _, err := io.ReadFull(r, buf[plainSize:]); err != nil {
|
if _, err := io.ReadFull(r, buf[plainSize:]); err != nil {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue