Skip to content

Hardening for AES-CCM sizing/nonce, DH params, PBKDF2 translate, CertPathBuilder floor - #271

Open
cconlon wants to merge 5 commits into
wolfSSL:masterfrom
cconlon:fenrirAug31
Open

Hardening for AES-CCM sizing/nonce, DH params, PBKDF2 translate, CertPathBuilder floor#271
cconlon wants to merge 5 commits into
wolfSSL:masterfrom
cconlon:fenrirAug31

Conversation

@cconlon

@cconlon cconlon commented Aug 31, 2026

Copy link
Copy Markdown
Member

This PR includes 5 Fenrir fixes:

  • F-12161: account for the AES-CCM auth tag in Cipher.engineGetOutputSize(), matching AES-GCM
  • F-12162: enforce the native 7-13 byte AES-CCM nonce limit at init(), generate a valid parameterless nonce, and reset AEAD tag length to the 128-bit default
  • F-12163: encode and decode the optional PKCS#3 DH privateValueLength, and reject trailing data
  • F-12164: reject a mismatched PRF in PBKDF2 translateKey() instead of silently re-deriving the key
  • F-12188: require wolfSSL 5.9.2 or later for the native X509 CertPathBuilder verifier

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

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

This PR hardens the wolfJCE provider and JNI glue around several cryptographic edge cases: AES-CCM output sizing/nonce handling, DH AlgorithmParameters encoding/decoding, PBKDF2 translateKey() strictness, and gating CertPathBuilder support on a newer wolfSSL version.

Changes:

  • Align AES-CCM behavior with AES-GCM for Cipher.getOutputSize(), enforce native CCM nonce bounds (7–13 bytes), generate a valid nonce for parameterless init, and reset AEAD tag length to the 128-bit default on parameterless init.
  • Extend DH AlgorithmParameters DER handling to encode/decode PKCS#3 privateValueLength (l) and reject trailing/invalid elements.
  • Require PBKDF2 translateKey() source PRF/algorithm to match the target SecretKeyFactory, and bump CertPathBuilder minimum wolfSSL requirement to 5.9.2+.

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/main/java/com/wolfssl/provider/jce/WolfCryptCipher.java Adds AES-CCM tag/nonce handling and AEAD default tag reset behavior to match native constraints.
src/test/java/com/wolfssl/provider/jce/test/WolfCryptCipherTest.java Adds/extends AES-CCM tests for output sizing, nonce validation, and parameterless init behavior.
src/main/java/com/wolfssl/provider/jce/WolfCryptDhParameters.java Implements DER parsing/encoding for optional DH privateValueLength and rejects trailing data.
src/test/java/com/wolfssl/provider/jce/test/WolfCryptAlgorithmParametersTest.java Adds DH AlgorithmParameters tests for preserving l and rejecting malformed encodings.
src/main/java/com/wolfssl/provider/jce/WolfCryptSecretKeyFactory.java Makes PBKDF2 translateKey() reject mismatched PRF/algorithm rather than re-deriving.
src/test/java/com/wolfssl/provider/jce/test/WolfCryptSecretKeyFactoryTest.java Adds regression test ensuring mismatched PBKDF2 PRF translation is rejected.
src/main/java/com/wolfssl/wolfcrypt/WolfSSLX509StoreCtx.java Updates CertPathBuilder support documentation/error text to wolfSSL 5.9.2+.
src/main/java/com/wolfssl/provider/jce/WolfCryptProvider.java Gates PKIX CertPathBuilder registration on updated wolfSSL 5.9.2+ support check.
src/test/java/com/wolfssl/provider/jce/test/WolfCryptPKIXCertPathBuilderTest.java Updates test skip guard/message for new CertPathBuilder wolfSSL minimum.
jni/jni_wolfssl_x509_store_ctx.c Raises native availability gate for CertPathBuilder to LIBWOLFSSL_VERSION_HEX >= 0x05009002.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/main/java/com/wolfssl/provider/jce/WolfCryptDhParameters.java
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