-
Notifications
You must be signed in to change notification settings - Fork 31
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
Improper nonce handling #102
Comments
Hey @dnkolegov tnx for opening issue.
|
Yes. That's correct. For example, https://github.com/flynn/noise/blob/master/state.go#L44-L46.
It should be noted that all other libp2p-noise implementations use Noise with 64-bit nonce. My concern here is that your implementation will throw an exception while a peer having another implementation (e.g., go-libp2p) would process it correctly. |
Pretty sure we will close connection and new connection will start from 0 nonce. That said it's highly unlikely anyone will ever pass uint32 number of messages in single connection 😄 |
There are two issues with nonce handling:
https://github.com/NodeFactoryIo/js-libp2p-noise/blob/master/src/%40types/handshake.d.ts#L12-L15
The spec requires returning an error if the maximum number is reached. This is the same issue as in the flynn package but more realistic due to 32-bit length.
https://github.com/NodeFactoryIo/js-libp2p-noise/blob/master/src/handshakes/abstract-handshake.ts#L46-L48
The text was updated successfully, but these errors were encountered: