Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle simulatenous auth for crypto handshake #117

Closed
germsvel opened this issue May 29, 2018 · 2 comments
Closed

Handle simulatenous auth for crypto handshake #117

germsvel opened this issue May 29, 2018 · 2 comments

Comments

@germsvel
Copy link
Contributor

germsvel commented May 29, 2018

When performing the crypto handshake, we send an auth and expect to receive an ack. But it is possible that at the same time as we send an auth message to a peer, the peer is sending their auth message to us.

From "Creating authenticated connection" in the RLPx docs

  1. initiator generates auth from ecdhe-random, static-shared-secret, and nonce (auth = authInitiator handshake)
  2. initiator connects to remote and sends auth
  3. optionally, remote decrypts and verifies auth (checks that recovery of signature == H(ephemeral-pubk))
  4. remote generates authAck from remote-ephemeral-pubk and nonce (authAck = authRecipient handshake)

optional: remote derives secrets and preemptively sends protocol-handshake (steps 9,11,8,10)

... 5-7 omitted here

  1. remote receives protocol-handshake
  2. remote derives shared-secret, aes-secret, mac-secret, ingress-mac, egress-mac
  3. remote authenticates protocol-handshake
  4. remote sends protocol-handshake

Currently, we do not handle that optional scenario. If we send an auth message, we only expect to receive an ack message.

All of the logic for the crypto handshake currently resides in the ExWire.P2P module.

@hayesgm
Copy link
Contributor

hayesgm commented Oct 29, 2018

@germsvel Was this already addressed in #235 or #252?

@germsvel
Copy link
Contributor Author

germsvel commented Dec 4, 2018

@hayesgm sorry for the late response. I don't know if this issue has been handled, but I also don't know if other clients actually do this. I think mana's flow assumes the peers will not preemptively send the protocol handshake. But I could be wrong.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants