Fix AES-CTS one-block and split-init IV handling - #476
Open
gasbytes wants to merge 2 commits into
Open
Conversation
There was a problem hiding this comment.
Pull request overview
This PR fixes two AES-CTS correctness issues in the wolfProvider AES stream implementation: (1) handling CTS for exactly one block, and (2) ensuring split-init sequences correctly preserve/use the IV when the key is set in a separate init call. It also adds targeted regression tests to prevent both issues from recurring.
Changes:
- Treat AES-CTS input of exactly one block as plain CBC (encrypt/decrypt) to match OpenSSL behavior and avoid out-of-bounds behavior.
- Update AES stream initialization to pass the cached
ctx->ivintowc_AesSetKeyso split init sequences keep the correct IV. - Add regression tests for one-block CTS and split-init IV handling.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
src/wp_aes_stream.c |
Adjusts key setup IV handling and adds special-case CTS logic for one-block inputs. |
test/test_cipher.c |
Adds regression tests covering one-block CTS behavior and split-init IV behavior. |
test/unit.c |
Registers the new unit tests in the test case table. |
test/unit.h |
Declares prototypes for the new unit tests. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
gasbytes
force-pushed
the
aes-related-fix
branch
from
August 26, 2026 13:33
d5479bc to
79c2e3f
Compare
gasbytes
marked this pull request as ready for review
August 26, 2026 13:37
This file contains hidden or 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
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.
Added associated regression test for each change (
test_aes128_cts_one_blockandtest_aes128_split_initrespectively).