Repository navigation
Add AES-XTS (AES-128-XTS, AES-256-XTS) - #510
Open
ColtonWilley wants to merge 2 commits into
Open
ColtonWilley wants to merge 2 commits into
ColtonWilley wants to merge 2 commits into
Conversation
Each update is one data unit through wolfCrypt's one-shot wc_AesXtsEncrypt/Decrypt, matching the OpenSSL default provider. Registered when wolfSSL 5.6.6+ is built with AES-XTS and the build is non-FIPS or FIPS v6+; the FIPS v5 module has no XTS. Equal key halves are rejected on encrypt, as in OpenSSL. On decrypt, wolfCrypt decides: it rejects them under FIPS and, by default, from wolfSSL 5.9.2, where OpenSSL's default provider accepts them. A failed wolfCrypt set-key leaves the context without a key, since the data key may already have been replaced. Context copy is refused when wolfSSL's Aes owns resources (WC_AESFREE_IS_MANDATORY).
Known answers and byte-exact cross-checks against the default provider, including ciphertext-stealing lengths; data-unit limits; equal key halves; key-only, IV-only and per-unit IV re-init; live re-keys in both directions; context copy; and params. The IEEE 1619 evp_test vectors move to their own file, run only when wolfProvider offers AES-XTS.
There was a problem hiding this comment.
🟡 Changes recommended
Repeated updates reuse the initial XTS tweak instead of rejecting unsupported streaming.
1 open finding
What changed in this PR
Adds AES-128-XTS and AES-256-XTS support backed by wolfCrypt.
Changes:
- Implements and registers AES-XTS with version/FIPS gating.
- Adds unit and IEEE 1619 vector tests.
- Updates build files and documentation.
| File | Description |
|---|---|
src/wp_aes_xts.c |
Implements AES-XTS provider operations. |
src/wp_wolfprov.c |
Registers AES-XTS ciphers. |
src/include.am |
Adds the implementation to builds. |
include/wolfprovider/settings.h |
Gates AES-XTS availability. |
include/wolfprovider/alg_funcs.h |
Declares names and dispatch tables. |
IDE/WINVS/wolfprovider/wolfprovider.vcxproj |
Adds Visual Studio compilation support. |
test/test_cipher.c |
Adds functional and compatibility tests. |
test/unit.c |
Registers new unit tests. |
test/unit.h |
Declares new unit tests. |
scripts/test-openssl.sh |
Conditionally runs XTS vectors. |
scripts/evp_test/evpciph_aes_xts.txt |
Adds IEEE 1619 vectors. |
README.md |
Documents AES-XTS support. |
docs/INTEGRATION_GUIDE.md |
Documents the wolfSSL build flag. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+463
to
+466
| if (ok) { | ||
| if (ctx->enc) { | ||
| rc = wc_AesXtsEncrypt(&ctx->xts, out, in, (word32)inLen, ctx->iv, | ||
| AES_BLOCK_SIZE); |
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.

Adds AES-XTS matching the OpenSSL default provider, built when wolfSSL 5.6.6+ has AES-XTS and the build is non-FIPS or FIPS v6+. One difference: wolfCrypt rejects equal key halves on decrypt (FIPS, and by default from 5.9.2), where OpenSSL accepts them. Covered by new unit tests and the IEEE 1619 evp_test vectors, and verified end to end with cryptsetup LUKS2
aes-xts-plain64.