Add SHAKE-128 and SHAKE-256 (FIPS 202 XOF) MessageDigest support - #274
Open
cconlon wants to merge 1 commit into
Open
Add SHAKE-128 and SHAKE-256 (FIPS 202 XOF) MessageDigest support#274cconlon wants to merge 1 commit into
cconlon wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
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.
Pull request overview
Adds SHAKE-128/SHAKE-256 (FIPS 202 XOF) support across the wolfCrypt JNI wrapper and the wolfJCE provider, including feature detection, provider registration, tests, and examples.
Changes:
- Introduces
com.wolfssl.wolfcrypt.Shakewith JNI bindings (jni_shake.c) and feature-detect toggles for SHAKE128/SHAKE256. - Registers JCE
MessageDigestalgorithmsSHAKE128-256andSHAKE256-512plus aliases (short names + NIST OIDs). - Adds comprehensive JNI/JCE test suites and a provider example for SHAKE usage.
Reviewed changes
Copilot reviewed 21 out of 23 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 ShakeTest to the wolfCrypt JNI test suite. |
| src/test/java/com/wolfssl/wolfcrypt/test/ShakeTest.java | Adds JNI-level SHAKE KATs, XOF length tests, ByteBuffer coverage, clone/release/threading tests. |
| src/test/java/com/wolfssl/provider/jce/test/WolfJCETestSuite.java | Adds WolfCryptMessageDigestShakeTest to the wolfJCE test suite. |
| src/test/java/com/wolfssl/provider/jce/test/WolfCryptMessageDigestShakeTest.java | Adds JCE-level SHAKE tests for digests, aliases, clone/reset, interop, and threading. |
| src/main/java/com/wolfssl/wolfcrypt/Shake.java | Adds the JNI-backed SHAKE wrapper with configurable XOF output length and clone support. |
| src/main/java/com/wolfssl/wolfcrypt/FeatureDetect.java | Adds native feature-detect methods for SHAKE128/SHAKE256 availability. |
| src/main/java/com/wolfssl/provider/jce/WolfCryptProvider.java | Registers SHAKE MessageDigest services and alias mappings (including OIDs). |
| src/main/java/com/wolfssl/provider/jce/WolfCryptMessageDigestShake.java | Adds JCE MessageDigestSpi wrapper for fixed-length SHAKE128-256 and SHAKE256-512. |
| spotbugs-exclude.xml | Suppresses SpotBugs findings for new SHAKE classes (constructor-throw + clone patterns). |
| scripts/infer.sh | Adds new classes to Infer static analysis compilation list. |
| makefile.macosx | Links jni_shake.o into the macOS JNI library build. |
| makefile.linux | Links jni_shake.o into the Linux JNI library build. |
| jni/jni_shake.c | Implements JNI glue for SHAKE init/update/final/copy/free for both variants. |
| jni/jni_feature_detect.c | Implements native checks for SHAKE128/SHAKE256 compile-time availability. |
| examples/provider/ShakeExample.sh | Adds a runnable script for the SHAKE provider example. |
| examples/provider/ShakeExample.java | Adds a Java example demonstrating fixed-length JCE and variable-length JNI XOF usage. |
| examples/provider/CryptoBenchmark.java | Adds SHAKE enablement gating for benchmark selection. |
| README_JCE.md | Documents SHAKE algorithms and their OID aliases in supported JCE algorithms list. |
| IDE/WIN/wolfcryptjni.vcxproj.filters | Adds jni_shake.c to the Windows project filters. |
| IDE/WIN/wolfcryptjni.vcxproj | Adds jni_shake.c to the Windows build. |
| IDE/Android/app/src/main/cpp/CMakeLists.txt | Adds jni_shake.c to the Android JNI build. |
Files not reviewed (2)
- jni/include/com_wolfssl_wolfcrypt_FeatureDetect.h: Generated file
- jni/include/com_wolfssl_wolfcrypt_Shake.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 SHAKE-128 and SHAKE-256 support at both the JNI and JCE levels:
com.wolfssl.wolfcrypt.Shakeclass andjni/jni_shake.cwrapping the nativewc_Shake128/256API, with arbitrary-length XOF output,clone()support, and native state zeroized on free.MessageDigestservicesSHAKE128-256(32-byte) andSHAKE256-512(64-byte), withSHAKE128/SHAKE256and NIST OID aliases.ShakeTest(JNI) andWolfCryptMessageDigestShakeTest(JCE)examples/provider/ShakeExample.java/.sh.Requires native wolfSSL with SHA-3/SHAKE enabled (default with
--enable-sha3).