Repository navigation
Reject AES-GCM/GMAC IVs under 96 bits on FIPS modules that mark them not approved - #293
Conversation
wolfSSL-Fenrir-bot
left a comment
There was a problem hiding this comment.
Fenrir Automated Review — PR #293
Scan targets checked: wolfcrypt-jni-src, wolfcrypt-jni-bugs
Coverage: 4 of 9 in-scope changed file(s) opened by the reviewer; not opened: jni/include/com_wolfssl_wolfcrypt_AesGcm.h, src/main/java/com/wolfssl/wolfcrypt/AesGcm.java, src/test/java/com/wolfssl/provider/jce/test/WolfCryptCipherTest.java, src/test/java/com/wolfssl/provider/jce/test/WolfCryptMacTest.java, src/test/java/com/wolfssl/wolfcrypt/test/WolfCryptTest.java
Fenrir result: Approved ✅
No new issues found in the changed files.
Advisory only — this automated result does not count as a GitHub approval.
Review tier: Lite
There was a problem hiding this comment.
🟡 Changes recommended
The allowed AES-GMAC test path does not execute the MAC operation where the original failure occurred.
3 open findings
What changed in this PR
Adds FIPS-aware short-IV validation for AES-GCM and AES-GMAC.
Changes:
- Detects FIPS modules where short IVs are not approved.
- Rejects affected IVs during JCE initialization.
- Maps
WC_FIPS_NOT_APPROVEDand adds regression tests.
| File | Description |
|---|---|
jni/jni_aesgcm.c |
Implements native FIPS-version detection. |
jni/include/com_wolfssl_wolfcrypt_AesGcm.h |
Declares the new JNI capability method. |
src/main/java/com/wolfssl/wolfcrypt/AesGcm.java |
Exposes nonce size and short-IV capability. |
src/main/java/com/wolfssl/wolfcrypt/WolfCryptError.java |
Maps the FIPS indicator error. |
src/main/java/com/wolfssl/provider/jce/WolfCryptCipher.java |
Rejects unapproved AES-GCM IVs at initialization. |
src/main/java/com/wolfssl/provider/jce/WolfCryptMac.java |
Rejects unapproved AES-GMAC IVs at initialization. |
src/test/java/com/wolfssl/wolfcrypt/test/WolfCryptTest.java |
Tests error mapping. |
src/test/java/com/wolfssl/provider/jce/test/WolfCryptCipherTest.java |
Tests AES-GCM short-IV behavior. |
src/test/java/com/wolfssl/provider/jce/test/WolfCryptMacTest.java |
Tests AES-GMAC short-IV behavior. |
Files not reviewed (1)
- jni/include/com_wolfssl_wolfcrypt_AesGcm.h: Generated file
🧠 Review effort: Balanced
Give feedback about Copilot approvals in this survey to enter a drawing for a $150 gift card.
…les that mark them not approved, map WC_FIPS_NOT_APPROVED
138ea6d to
17ac9f2
Compare


This PR handles the FIPS 140-3 approved-service indicator (
WC_FIPS_NOT_APPROVED, 1) that wolfCrypt FIPS v5.2.4 and v7+ return for AES-GCM/GMAC with IVs under 96 bits. Previously this was thrown atdoFinal()as an uncheckedWolfCryptExceptionwith an unmapped error code.AesGcm.shortIvAllowed()andAesGcm.GCM_NONCE_MID_SZ.Cipherand AES-GMACMacthrowInvalidAlgorithmParameterExceptionatinit()for IVs under 96 bits on those modules.WolfCryptError.WC_FIPS_NOT_APPROVEDtestAesGcmShortIv,testAesGmacShortIv,testFipsNotApprovedError.Fixes OpenJDK
GCMParameterSpecTestandTestKATForGCMshort-IV failures on wolfCrypt FIPS Ready (v7).