Skip to content

Commit f4cb3d9

Browse files
committed
p2p/rlpx: remove ecies package in Secrets
1 parent f48867e commit f4cb3d9

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

p2p/rlpx/rlpx.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ func (c *Conn) Handshake(prv *ecdsa.PrivateKey) (*ecdsa.PublicKey, error) {
268268
return nil, err
269269
}
270270
c.InitWithSecrets(sec)
271-
return sec.Remote.ExportECDSA(), err
271+
return sec.Remote, err
272272
}
273273

274274
// InitWithSecrets injects connection secrets as if a handshake had
@@ -334,7 +334,7 @@ var (
334334

335335
// Secrets represents the connection secrets which are negotiated during the handshake.
336336
type Secrets struct {
337-
Remote *ecies.PublicKey
337+
Remote *ecdsa.PublicKey
338338
AES, MAC []byte
339339
EgressMAC, IngressMAC hash.Hash
340340
Token []byte
@@ -450,7 +450,7 @@ func (h *encHandshake) secrets(auth, authResp []byte) (Secrets, error) {
450450
sharedSecret := crypto.Keccak256(ecdheSecret, crypto.Keccak256(h.respNonce, h.initNonce))
451451
aesSecret := crypto.Keccak256(ecdheSecret, sharedSecret)
452452
s := Secrets{
453-
Remote: h.remote,
453+
Remote: h.remote.ExportECDSA(),
454454
AES: aesSecret,
455455
MAC: crypto.Keccak256(ecdheSecret, aesSecret),
456456
}

p2p/server_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ import (
2828
"time"
2929

3030
"github.com/ethereum/go-ethereum/crypto"
31-
"github.com/ethereum/go-ethereum/crypto/ecies"
3231
"github.com/ethereum/go-ethereum/internal/testlog"
3332
"github.com/ethereum/go-ethereum/log"
3433
"github.com/ethereum/go-ethereum/p2p/enode"
@@ -45,7 +44,7 @@ type testTransport struct {
4544
func newTestTransport(rpub *ecdsa.PublicKey, fd net.Conn, dialDest *ecdsa.PublicKey) transport {
4645
wrapped := newRLPX(fd, dialDest).(*rlpxTransport)
4746
wrapped.conn.InitWithSecrets(rlpx.Secrets{
48-
Remote: ecies.ImportECDSAPublic(rpub),
47+
Remote: rpub,
4948
AES: make([]byte, 16),
5049
MAC: make([]byte, 16),
5150
EgressMAC: sha256.New(),

0 commit comments

Comments
 (0)