Skip to content

Add AES-CFB (CFB1/CFB8/CFB128) support to JNI/JCE - #272

Open
cconlon wants to merge 1 commit into
wolfSSL:masterfrom
cconlon:aescfb
Open

Add AES-CFB (CFB1/CFB8/CFB128) support to JNI/JCE#272
cconlon wants to merge 1 commit into
wolfSSL:masterfrom
cconlon:aescfb

Conversation

@cconlon

@cconlon cconlon commented Aug 31, 2026

Copy link
Copy Markdown
Member

This PR adds AES-CFB support, wrapping native wolfSSL's wc_AesCfb*/wc_AesCfb1*/wc_AesCfb8* APIs.

  • New com.wolfssl.wolfcrypt.AesCfb JNI class (jni/jni_aescfb.c), segment size (128/8/1-bit) selected at construction.
  • wolfJCE Cipher services: AES/CFB/NoPadding (with CFB128, AES_128/192/256 aliases and NIST OIDs .4/.24/.44), AES/CFB8/NoPadding, and AES/CFB1/NoPadding.
  • Tests: NIST SP 800-38A F.3 KATs for all segment/key sizes in both directions, chunked-streaming equivalence, ByteBuffer paths, SunJCE/BC interop, threading, and OID alias tests.
  • Adds examples/provider/AesCfbExample

Requires native wolfSSL built with --enable-aescfb (or --enable-all).

@cconlon cconlon self-assigned this Aug 31, 2026
Copilot AI lite review requested due to automatic review settings August 31, 2026 23:04

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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.AesCfb JNI 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 WolfCryptCipher mode 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.

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