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

x.crypto.chacha20: changes internal cipher representation to support 64 bit ctr #24039

Merged
merged 1 commit into from
Mar 25, 2025

Conversation

blackshirt
Copy link
Contributor

@blackshirt blackshirt commented Mar 25, 2025

Related to this issues, here is the plan to add support for original ChaCha20 stream cipher with 64 bit counter.

  • The changes was needed to the internal chacha20.Cipher representation (was done in this PR). Its changed to the raw 128 bytes of[4]u32 opaque where the counter was contained internally and handles transparently. Previously, its separated in the nonce and counter of the Cipher field's.
  • Adding 64 bit counter handling and related keystream generation that aware of new size of counter (not ready)
  • Make stream cipher creation support for 64-bit counter variant. Its partially was done in this PR, but still not fully supported.
  • Make xor_key_stream and other routines awares for 64-bit counter variant
  • Adds 64-bit counter test
  • Integrates the changes with the rest

This PR contains some bits of them, but its not fully activated support for 64-bit counter variant.
The fundamental changes in this PR was the change of internal representation of the nonce and counter of chacha20.Cipher field's into raw nonce and make enrcyption routines work and aware of this changes..
Its also contains some cleansup bits and code safety checking

Thanks

Copy link

Connected to Huly®: V_0.6-22431

@spytheman spytheman merged commit 2b76902 into vlang:master Mar 25, 2025
62 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