-
Notifications
You must be signed in to change notification settings - Fork 119
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Fix nonce incrementing in stateful transport to match the specification #152
Fix nonce incrementing in stateful transport to match the specification #152
Conversation
This looks good, and given the wording of that nonce being reserved, I'm wondering if the same restriction should be placed on Lines 123 to 153 in b55a713
|
That's a valid question, and I almost had implemented that too. The specification is unclear if "reserved" means "reserved for Noise" or "reserved for a protocol to use for certain things." If its the first interpretation, we should, but in the second we might prevent an otherwise valid use case. |
Given the wording for 11.4. Out-of-order transport messages, I think we should cautiously treat it as abiding by the same rules as the in-order transports, if you don't mind adding that to this PR. I asked for clarification and if I hear anything to the contrary we can update. |
Ah yes, |
Oh great catch! I agree we need the check everywhere then. I'll update this PR shortly. |
Thanks to Trevor for pointing it out :). |
5c1d3a3
to
8cbfc4d
Compare
8cbfc4d
to
2b5fb4c
Compare
I have pushed the changes that now include validations for the stateless cipher function as well. |
Thanks, this looks great. The only thought I had is that |
This PR fixes #150 by correcting the stateful encrypt/decrypt functions to never use the reserved value of
u64::MAX
, which additionally guarantees a lack of wraparound issues.In addition, a unit test was added to ensure this behavior does not regress by mistake.
Fixes #150