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

chacha20: avoid panic on counter overflow #70

Closed
tarcieri opened this issue Oct 23, 2019 · 3 comments
Closed

chacha20: avoid panic on counter overflow #70

tarcieri opened this issue Oct 23, 2019 · 3 comments

Comments

@tarcieri
Copy link
Member

To avoid repeating the keystream on counter overflow, #68 added an assertion that the counter value is less than chacha20::MAX_BLOCKS.

Ideally SalsaFamilyCipher::block can be changed to use a fallible API, so instead of panicking it returns an error when the counter overflows.

@srijs
Copy link
Contributor

srijs commented Oct 24, 2019

Would it be worth thinking about how to achieve this w/o breaking changes (e.g. add a try_block method with a sensible default impl), or do you generally think this warrants a major version bump?

@tarcieri
Copy link
Member Author

@srijs I'd like to make some potentially breaking changes anyway. I opened a separate thread about those: #71

@tarcieri
Copy link
Member Author

tarcieri commented Jun 6, 2020

I believe this logic should address the issue:

https://github.com/RustCrypto/stream-ciphers/blob/68e3467/chacha20/src/cipher.rs#L182-L188

@tarcieri tarcieri closed this as completed Jun 6, 2020
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

No branches or pull requests

2 participants