Skip to content

chacha20: Reorder MAC verification and decryption process - #254

Merged
utelle merged 1 commit into
utelle:mainfrom
matbech:patch-1
Sep 3, 2026
Merged

utelle merged 1 commit into
utelle:mainfrom
matbech:patch-1

Conversation

@matbech

@matbech matbech commented Sep 3, 2026 •

Copy link
Copy Markdown
Contributor

Description

Refactor decryption logic to verify MAC before decrypting data. In addition, it removes the unused allzero variable and chacha20_ismemset check.

Problem Statement

  • verify MAC before decrypting data
  • remove unused allzero variable and check

Type of Change

Please select the type of change:

  • Refactor

Checklist

  • I have independently verified the issue
  • I am not submitting unverified or speculative changes
  • I understand that AI-assisted changes must be reviewed by a human before submission

Refactor decryption logic to verify MAC before decrypting data.
In addition, it removes the unused allzero variable and chacha20_ismemset check.
@utelle

utelle commented Sep 3, 2026

Copy link
Copy Markdown
Owner

Refactor decryption logic to verify MAC before decrypting data.

For normal operation the order doesn't matter, but in the event of an error it makes sense. Most likely the same logic should be applied to other cipher schemes with MACs.

In addition, it removes the unused allzero variable and chacha20_ismemset check.

Most likely I was distracted somehow back then when I added this test. AFAICR a special case can occur where the page is allzero, and maybe that should be handled explicitly. I have to dig in my notes to be sure.

@utelle
utelle merged commit 836d29d into utelle:main Sep 3, 2026
9 checks passed
@matbech
matbech deleted the patch-1 branch September 3, 2026 16:28
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