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: adding 64-bit counter support #359

Open
wants to merge 11 commits into
base: master
Choose a base branch
from

Conversation

nstilt1
Copy link
Contributor

@nstilt1 nstilt1 commented Jun 8, 2024

Addresses #334

The constant booleans in the backends should be evaluated at compile-time... but there's a slight chance that I could write a test for the ChaCha20Rng that fails on aarch64 with neon. The original add64 macro does what the name suggests, it adds vectors in a 64-bit fashion, meaning that it could perform addition incorrectly when the counter should be 32 bits and the counter is exceeding the u32::MAX.

This shouldn't be an issue with the ChaCha20 cipher since cipher panics when the counter will exceed u32::MAX, but ChaCha20Rng wraps around and is currently supposed to use a 32-bit counter. I'm going to write one more test to see if I can get it to fail, and if it fails, then I'll probably need to change add64 to accept a boolean for performing 32-bit or 64-bit addition.

@nstilt1 nstilt1 marked this pull request as ready for review June 8, 2024 13:59
chacha20/src/variants.rs Outdated Show resolved Hide resolved
@tarcieri tarcieri changed the title Adding 64-bit counter support chacha20: adding 64-bit counter support Aug 10, 2024
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