Add AES-XTS support - #268
Open
cconlon wants to merge 1 commit into
Open
Conversation
There was a problem hiding this comment.
Pull request overview
Warning
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
Adds AES-XTS (IEEE 1619 / NIST SP 800-38E) support across the JNI wolfcrypt wrapper and the wolfJCE provider, plus tests, examples, and build/workflow wiring to cover both native streaming and non-streaming fallback behavior.
Changes:
- Introduces
com.wolfssl.wolfcrypt.AesXtsJNI wrapper and native JNI implementation (jni_aesxts.c) plus feature-detection hooks. - Registers
Cipher.AES/XTS/NoPadding(and aliases) in the JCE provider and updatesWolfCryptCipherto handle XTS streaming vs buffer-until-doFinal()behavior. - Adds extensive JNI and JCE test coverage and an example, plus build/project/workflow updates to compile and exercise AES-XTS.
Reviewed changes
Copilot reviewed 20 out of 22 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| src/test/java/com/wolfssl/wolfcrypt/test/WolfCryptTestSuite.java | Adds AesXtsTest to the overall wolfcrypt JNI test suite. |
| src/test/java/com/wolfssl/wolfcrypt/test/AesXtsTest.java | Adds comprehensive JNI wrapper tests for one-shot, sector, and streaming APIs. |
| src/test/java/com/wolfssl/provider/jce/test/WolfCryptCipherTest.java | Adds JCE-level AES-XTS tests (vectors, streaming/off fallback, ByteBuffer, interop) and an additional CBC update/output-size regression test. |
| src/main/java/com/wolfssl/wolfcrypt/FeatureDetect.java | Adds native feature-detect methods for AES-XTS and AES-XTS streaming. |
| src/main/java/com/wolfssl/wolfcrypt/AesXts.java | New Java JNI wrapper for AES-XTS with one-shot, sector, and streaming APIs. |
| src/main/java/com/wolfssl/provider/jce/WolfCryptProvider.java | Registers AES/XTS/NoPadding and aliases when AES-XTS is available. |
| src/main/java/com/wolfssl/provider/jce/WolfCryptCipher.java | Implements XTS mode support including output sizing, buffering/streaming decisions, and reset behavior. |
| spotbugs-exclude.xml | Excludes SpotBugs CT_CONSTRUCTOR_THROW for AesXts (constructor can throw if not compiled in). |
| scripts/infer.sh | Adds AesXts.java to Infer static analysis compilation list. |
| makefile.macosx | Adds jni_aesxts.o to macOS build object list. |
| makefile.linux | Adds jni_aesxts.o to Linux build object list. |
| jni/jni_feature_detect.c | Implements JNI feature-detect for AesXtsEnabled and AesXtsStreamEnabled. |
| jni/jni_aesxts.c | New JNI bridge implementing AES-XTS one-shot, sector, and streaming operations. |
| examples/provider/AesXtsExample.sh | Adds a runnable shell script for the AES-XTS provider example. |
| examples/provider/AesXtsExample.java | Adds a wolfJCE AES-XTS example demonstrating sector tweaks and partial-block data units. |
| README_JCE.md | Documents AES/XTS/NoPadding and aliases as supported algorithms. |
| IDE/WIN/wolfcryptjni.vcxproj.filters | Adds jni_aesxts.c to the Windows filters file. |
| IDE/WIN/wolfcryptjni.vcxproj | Adds jni_aesxts.c and generated header to the Windows project. |
| IDE/Android/app/src/main/cpp/CMakeLists.txt | Adds jni_aesxts.c to Android build inputs. |
| .github/workflows/main.yml | Adds a CI permutation to run --disable-aesxts-stream for the non-streaming fallback path. |
Files not reviewed (2)
- jni/include/com_wolfssl_wolfcrypt_AesXts.h: Generated file
- jni/include/com_wolfssl_wolfcrypt_FeatureDetect.h: Generated file
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
cconlon
force-pushed
the
aesXts
branch
2 times, most recently
from
August 27, 2026 23:42
616ed98 to
07b3add
Compare
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.
This PR adds AES-XTS (IEEE 1619 / NIST SP 800-38E) at both JNI/JCE layers.
com.wolfssl.wolfcrypt.AesXtsclass with one-shot, sector-number, and streaming APIs, inbyte[]and directByteBuffervariants.Cipher.AES/XTS/NoPadding(aliasesAES_128/XTS/NoPadding,AES_256/XTS/NoPadding):IvParameterSpec.update()streams when native streaming is compiled in, otherwise buffers untildoFinal().AesXtsTestandWolfCryptCipherTestcases using vectors from wolfSSLwolfcrypt/test/test.cand IEEE 1619Annex B.
--enable-allwith--disable-aesxts-streamto cover the non-streaming fallback.examples/provider/AesXtsExampleRequires wolfSSL built with
--enable-aesxts(enabled by default with--enable-all).