Skip to content

x.crypto.chacha20poly1305: small cleans up and improves safety check#25631

Merged
spytheman merged 9 commits into
vlang:masterfrom
blackshirt:psiv
Oct 31, 2025
Merged

x.crypto.chacha20poly1305: small cleans up and improves safety check#25631
spytheman merged 9 commits into
vlang:masterfrom
blackshirt:psiv

Conversation

@blackshirt

@blackshirt blackshirt commented Oct 31, 2025

Copy link
Copy Markdown
Contributor

After some while for looking it back, i think there are some deficiency that can be improved on. Two's main changes on this pr was

  • Changes precomp flag to done flag. precomputation phase for deriving keys was already done and stored on the mac_key, enc_key and poly1305 instance set on psiv creation. By changing to done flag to mark this psiv construct as unusable anymore and effectively preventing to call .encrypt or .decrypt. so we can just returns error if it happens, instead of panic.
  • Removes out key field. Its not used on any other places. Its already stored on derived keys, so we can safely remove this out.
  • Small cleans up by changing hard coded length on vmemset call
  • Add safety check on .encrypt and .decrypt call to aware of done flag

Thanks,
Cheers.

@tankf33der

Copy link
Copy Markdown
Contributor

All passed.

@spytheman spytheman merged commit 180253f into vlang:master Oct 31, 2025
73 checks passed
@spytheman

Copy link
Copy Markdown
Contributor

Thank you @blackshirt 🙇🏻 .

@blackshirt blackshirt deleted the psiv branch October 31, 2025 22:40
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.

3 participants