-
Notifications
You must be signed in to change notification settings - Fork 52
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
Draft
nstilt1
wants to merge
11
commits into
RustCrypto:master
Choose a base branch
from
nstilt1:counter_support_2.0
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…ST_BLOCKS sizes, but 4 and 10 were failing, among others. Problem was the 64-bit addition was not being applied properly when adding the counter to the state prior to writing blocks to the dest
tarcieri
reviewed
Jul 30, 2024
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 onaarch64
with neon. The originaladd64
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 theu32::MAX
.This shouldn't be an issue with the
ChaCha20
cipher sincecipher
panics when the counter will exceedu32::MAX
, butChaCha20Rng
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 changeadd64
to accept a boolean for performing 32-bit or 64-bit addition.