Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
Geth-Modification
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
张蕾
Geth-Modification
Commits
fe6a9473
Commit
fe6a9473
authored
6 years ago
by
Wenbiao Zheng
Committed by
Felix Lange
6 years ago
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
p2p: token is useless in xxxEncHandshake (#17230)
parent
526abe27
master
v1.10.12
v1.10.12-modified
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
8 deletions
+7
-8
rlpx.go
p2p/rlpx.go
+7
-8
No files found.
p2p/rlpx.go
View file @
fe6a9473
...
...
@@ -181,9 +181,9 @@ func (t *rlpx) doEncHandshake(prv *ecdsa.PrivateKey, dial *discover.Node) (disco
err
error
)
if
dial
==
nil
{
sec
,
err
=
receiverEncHandshake
(
t
.
fd
,
prv
,
nil
)
sec
,
err
=
receiverEncHandshake
(
t
.
fd
,
prv
)
}
else
{
sec
,
err
=
initiatorEncHandshake
(
t
.
fd
,
prv
,
dial
.
ID
,
nil
)
sec
,
err
=
initiatorEncHandshake
(
t
.
fd
,
prv
,
dial
.
ID
)
}
if
err
!=
nil
{
return
discover
.
NodeID
{},
err
...
...
@@ -280,9 +280,9 @@ func (h *encHandshake) staticSharedSecret(prv *ecdsa.PrivateKey) ([]byte, error)
// it should be called on the dialing side of the connection.
//
// prv is the local client's private key.
func
initiatorEncHandshake
(
conn
io
.
ReadWriter
,
prv
*
ecdsa
.
PrivateKey
,
remoteID
discover
.
NodeID
,
token
[]
byte
)
(
s
secrets
,
err
error
)
{
func
initiatorEncHandshake
(
conn
io
.
ReadWriter
,
prv
*
ecdsa
.
PrivateKey
,
remoteID
discover
.
NodeID
)
(
s
secrets
,
err
error
)
{
h
:=
&
encHandshake
{
initiator
:
true
,
remoteID
:
remoteID
}
authMsg
,
err
:=
h
.
makeAuthMsg
(
prv
,
token
)
authMsg
,
err
:=
h
.
makeAuthMsg
(
prv
)
if
err
!=
nil
{
return
s
,
err
}
...
...
@@ -306,7 +306,7 @@ func initiatorEncHandshake(conn io.ReadWriter, prv *ecdsa.PrivateKey, remoteID d
}
// makeAuthMsg creates the initiator handshake message.
func
(
h
*
encHandshake
)
makeAuthMsg
(
prv
*
ecdsa
.
PrivateKey
,
token
[]
byte
)
(
*
authMsgV4
,
error
)
{
func
(
h
*
encHandshake
)
makeAuthMsg
(
prv
*
ecdsa
.
PrivateKey
)
(
*
authMsgV4
,
error
)
{
rpub
,
err
:=
h
.
remoteID
.
Pubkey
()
if
err
!=
nil
{
return
nil
,
fmt
.
Errorf
(
"bad remoteID: %v"
,
err
)
...
...
@@ -324,7 +324,7 @@ func (h *encHandshake) makeAuthMsg(prv *ecdsa.PrivateKey, token []byte) (*authMs
}
// Sign known message: static-shared-secret ^ nonce
token
,
err
=
h
.
staticSharedSecret
(
prv
)
token
,
err
:
=
h
.
staticSharedSecret
(
prv
)
if
err
!=
nil
{
return
nil
,
err
}
...
...
@@ -352,8 +352,7 @@ func (h *encHandshake) handleAuthResp(msg *authRespV4) (err error) {
// it should be called on the listening side of the connection.
//
// prv is the local client's private key.
// token is the token from a previous session with this node.
func
receiverEncHandshake
(
conn
io
.
ReadWriter
,
prv
*
ecdsa
.
PrivateKey
,
token
[]
byte
)
(
s
secrets
,
err
error
)
{
func
receiverEncHandshake
(
conn
io
.
ReadWriter
,
prv
*
ecdsa
.
PrivateKey
)
(
s
secrets
,
err
error
)
{
authMsg
:=
new
(
authMsgV4
)
authPacket
,
err
:=
readHandshakeMsg
(
authMsg
,
encAuthMsgLen
,
prv
,
conn
)
if
err
!=
nil
{
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment