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

Use full range of the stream counter for StreamLE31 #641

Merged
merged 1 commit into from
Oct 23, 2024

Conversation

Eosis
Copy link
Contributor

@Eosis Eosis commented Oct 23, 2024

I believe that we the StreamPrimitive for StreamLE31 in the library is not using the correct value for COUNTER_MAX, choosing 0x0FFF_FFFF rather than 0x7FFF_FFFF, resulting in a reduced space for the message counter. This commit changes the value to use the full range.

I do not believe this is a security issue, but it does reduce the functionality of the library.

Let me know if my understanding of the problem is incorrect or if I'm attempting to commit this to the wrong library.

The maximum value of the 31 bit counter should be 0x7FFFFFFF, rather
than 0x0FFFFFFF. Using this version allows a stream which has
eight times as many messages and is more consistent with the code that
calculates the nonce value for the last block which uses
`((last_block as u32) << 31`.
@Eosis
Copy link
Contributor Author

Eosis commented Oct 23, 2024

Sister PR in the crypto traits lib where I originally found this issue on the 0.5.2 release:
RustCrypto/traits#1708

@newpavlov newpavlov merged commit 37fc591 into RustCrypto:master Oct 23, 2024
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants