Add AES-CFB (CFB1/CFB8/CFB128) support to JNI/JCE - #272
Open
cconlon wants to merge 1 commit into
Open
Conversation
There was a problem hiding this comment.
Pull request overview
Adds AES-CFB (CFB128/CFB8/CFB1) support across the wolfCrypt JNI layer and wolfJCE provider so applications can use standard Cipher transformations like AES/CFB/NoPadding (plus aliases/OIDs) backed by wolfSSL’s native wc_AesCfb* APIs.
Changes:
- Introduces
com.wolfssl.wolfcrypt.AesCfbJNI wrapper + native implementation (jni_aescfb.c) and feature-detection hooks for CFB/CFB1/CFB8. - Registers new wolfJCE cipher services/aliases (including NIST OIDs) and wires CFB into
WolfCryptCiphermode handling. - Adds comprehensive JNI/JCE tests and a provider example for AES-CFB.
Reviewed changes
Copilot reviewed 19 out of 21 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/test/java/com/wolfssl/wolfcrypt/test/WolfCryptTestSuite.java | Adds new JNI-level AES-CFB test to the wolfCrypt test suite. |
| src/test/java/com/wolfssl/wolfcrypt/test/AesCfbTest.java | New JNI wrapper tests for CFB128/CFB8/CFB1 behavior, ByteBuffer paths, and threading. |
| src/test/java/com/wolfssl/provider/jce/test/WolfCryptCipherTest.java | Extends provider cipher tests with AES-CFB KATs, streaming, interop, threading, and OID/alias coverage. |
| src/main/java/com/wolfssl/wolfcrypt/FeatureDetect.java | Adds native feature-detect declarations for AES-CFB/CFB1/CFB8. |
| src/main/java/com/wolfssl/wolfcrypt/AesCfb.java | New JNI wrapper class for AES-CFB with selectable segment size and streaming update APIs. |
| src/main/java/com/wolfssl/provider/jce/WolfCryptProvider.java | Registers AES/CFB* cipher services and NIST alias/OID mappings when enabled. |
| src/main/java/com/wolfssl/provider/jce/WolfCryptCipher.java | Adds CFB modes and integrates them into buffering/output-size/padding logic and native struct lifecycle. |
| scripts/infer.sh | Adds new AesCfb.java to Infer’s analysis inputs. |
| README_JCE.md | Documents newly supported AES-CFB transformations and aliases/OIDs. |
| makefile.macosx | Adds jni_aescfb.o to macOS native build object list. |
| makefile.linux | Adds jni_aescfb.o to Linux native build object list. |
| jni/jni_feature_detect.c | Implements FeatureDetect.AesCfb*Enabled() JNI methods. |
| jni/jni_aescfb.c | New native JNI implementation wrapping wolfSSL’s wc_AesCfb* APIs. |
| jni/include/com_wolfssl_wolfcrypt_FeatureDetect.h | Updates generated header with new AES-CFB feature detect declarations. |
| jni/include/com_wolfssl_wolfcrypt_AesCfb.h | Adds generated JNI header for the new AesCfb class. |
| IDE/WIN/wolfcryptjni.vcxproj.filters | Adds jni_aescfb.c to Visual Studio filters. |
| IDE/WIN/wolfcryptjni.vcxproj | Adds jni_aescfb.c to the Visual Studio project. |
| IDE/Android/app/src/main/cpp/CMakeLists.txt | Enables AES-CFB define and compiles jni_aescfb.c for Android builds. |
| examples/provider/AesCfbExample.sh | New script to run the AES-CFB provider example. |
| examples/provider/AesCfbExample.java | New example demonstrating AES/CFB and AES/CFB8 usage via wolfJCE. |
Files not reviewed (2)
- jni/include/com_wolfssl_wolfcrypt_AesCfb.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.
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-CFB support, wrapping native wolfSSL's wc_AesCfb*/wc_AesCfb1*/wc_AesCfb8* APIs.
com.wolfssl.wolfcrypt.AesCfbJNI class (jni/jni_aescfb.c), segment size (128/8/1-bit) selected at construction.AES/CFB/NoPadding(with CFB128, AES_128/192/256 aliases and NIST OIDs .4/.24/.44),AES/CFB8/NoPadding, andAES/CFB1/NoPadding.examples/provider/AesCfbExampleRequires native wolfSSL built with
--enable-aescfb(or--enable-all).