Skip to content

crypto.cipher: fix decryption in CBC mode, add test#25584

Merged
spytheman merged 1 commit into
vlang:masterfrom
tankf33der:cipher-cbc
Oct 24, 2025
Merged

crypto.cipher: fix decryption in CBC mode, add test#25584
spytheman merged 1 commit into
vlang:masterfrom
tankf33der:cipher-cbc

Conversation

@tankf33der

Copy link
Copy Markdown
Contributor

The test against golang failed and a trivial audit showed that a typo occurred again.
Worked for a long time on the test to properly trigger the decryption error.
This new test cannot pass on master.
Please review my work and approve.

@spytheman spytheman left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent work.

It was not a typo imho in the sense, that it was not just a small mismatch on the letters. The old code had a clear semantic bug.


fn test_aes_cbc_double() {
orig1 := []u8{len: 64, init: index}
orig2 := []u8{len: 16, init: index}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure if it may have been better to use a more varied content, something like init: index*10 .

@spytheman spytheman merged commit 43c45d9 into vlang:master Oct 24, 2025
73 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