Skip to content

Commit

Permalink
p2p/rlpx: remove ecies package in Secrets
Browse files Browse the repository at this point in the history
  • Loading branch information
fjl committed Sep 15, 2020
1 parent f48867e commit f4cb3d9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
6 changes: 3 additions & 3 deletions p2p/rlpx/rlpx.go
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ func (c *Conn) Handshake(prv *ecdsa.PrivateKey) (*ecdsa.PublicKey, error) {
return nil, err
}
c.InitWithSecrets(sec)
return sec.Remote.ExportECDSA(), err
return sec.Remote, err
}

// InitWithSecrets injects connection secrets as if a handshake had
Expand Down Expand Up @@ -334,7 +334,7 @@ var (

// Secrets represents the connection secrets which are negotiated during the handshake.
type Secrets struct {
Remote *ecies.PublicKey
Remote *ecdsa.PublicKey
AES, MAC []byte
EgressMAC, IngressMAC hash.Hash
Token []byte
Expand Down Expand Up @@ -450,7 +450,7 @@ func (h *encHandshake) secrets(auth, authResp []byte) (Secrets, error) {
sharedSecret := crypto.Keccak256(ecdheSecret, crypto.Keccak256(h.respNonce, h.initNonce))
aesSecret := crypto.Keccak256(ecdheSecret, sharedSecret)
s := Secrets{
Remote: h.remote,
Remote: h.remote.ExportECDSA(),
AES: aesSecret,
MAC: crypto.Keccak256(ecdheSecret, aesSecret),
}
Expand Down
3 changes: 1 addition & 2 deletions p2p/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ import (
"time"

"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/crypto/ecies"
"github.com/ethereum/go-ethereum/internal/testlog"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/p2p/enode"
Expand All @@ -45,7 +44,7 @@ type testTransport struct {
func newTestTransport(rpub *ecdsa.PublicKey, fd net.Conn, dialDest *ecdsa.PublicKey) transport {
wrapped := newRLPX(fd, dialDest).(*rlpxTransport)
wrapped.conn.InitWithSecrets(rlpx.Secrets{
Remote: ecies.ImportECDSAPublic(rpub),
Remote: rpub,
AES: make([]byte, 16),
MAC: make([]byte, 16),
EgressMAC: sha256.New(),
Expand Down

0 comments on commit f4cb3d9

Please sign in to comment.