Skip to content

Fenrir fixes#212

Merged
cconlon merged 14 commits intowolfSSL:masterfrom
rlm2002:fenrir
Apr 29, 2026
Merged

Fenrir fixes#212
cconlon merged 14 commits intowolfSSL:masterfrom
rlm2002:fenrir

Conversation

@rlm2002
Copy link
Copy Markdown
Contributor

@rlm2002 rlm2002 commented Apr 24, 2026

Fixes 14 Fenrir reports. Includes zeroing out buffers, correcting references, and adjusts when DhGenerateKeyPair exceptions are returned in JNI layer.

28-04-2026: Add on 5 more Fenrir reports. Zeros out buffers and adjusts output buffer offset positioning.

@rlm2002 rlm2002 self-assigned this Apr 24, 2026
Copy link
Copy Markdown

@wolfSSL-Fenrir-bot wolfSSL-Fenrir-bot left a comment

Choose a reason for hiding this comment

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

Fenrir Automated Review — PR #212

Scan targets checked: wolfcrypt-jni-bugs, wolfcrypt-jni-src

No new issues found in the changed files. ✅

Copy link
Copy Markdown

Copilot AI left a comment

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 addresses a set of Fenrir reports across the JCE provider and JNI layers, primarily by ensuring sensitive temporary buffers are wiped and by tightening JNI error/exception handling behavior (notably around DH keypair generation).

Changes:

  • Zero out sensitive temporary key material in multiple JCE provider paths (KeyStore, Signature, Cipher, MAC, KeyFactories).
  • Use wc_ForceZero (when available) before freeing native buffers in several JNI wrappers.
  • Adjust JNI DH keypair generation flow to avoid additional JNI calls when an exception is already pending.

Reviewed changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/main/java/com/wolfssl/provider/jce/WolfSSLKeyStore.java Zero PKCS#8 private key encoding buffer after cert/key match check.
src/main/java/com/wolfssl/provider/jce/WolfCryptSignature.java Zero encoded private key bytes after initializing signing.
src/main/java/com/wolfssl/provider/jce/WolfCryptRSAKeyFactory.java Zero encoded key buffers after building PKCS#8 specs / translating keys.
src/main/java/com/wolfssl/provider/jce/WolfCryptMac.java Zero encoded secret key bytes after MAC initialization.
src/main/java/com/wolfssl/provider/jce/WolfCryptECKeyFactory.java Zero encoded EC key buffers after creating PKCS#8 specs / translating keys.
src/main/java/com/wolfssl/provider/jce/WolfCryptDHKeyFactory.java Zero encoded DH key buffers after creating PKCS#8 specs / translating keys.
src/main/java/com/wolfssl/provider/jce/WolfCryptCipher.java Zero encoded key material after key setup, key size query, and wrapping.
jni/jni_rsa.c Force-zero temporary RSA buffers before free when supported.
jni/jni_pwdbased.c Force-zero derived-key buffers before free; correct unused-variable reference.
jni/jni_ecc.c Force-zero temporary ECC buffers before free; fix UTF string release on error.
jni/jni_dh.c Adjust exception flow in DH key generation; force-zero DH buffers before free.
jni/jni_asn.c Force-zero PKCS#8 copy buffer before free when supported.
jni/jni_aesgcm.c Force-zero decrypt output buffer before free when supported.
jni/jni_aesccm.c Force-zero decrypt output buffer before free when supported.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread jni/jni_dh.c
@rlm2002 rlm2002 force-pushed the fenrir branch 2 times, most recently from 6ade0bb to db20ab7 Compare April 28, 2026 17:46
@rlm2002 rlm2002 assigned cconlon and rlm2002 and unassigned rlm2002 and cconlon Apr 29, 2026
Comment thread jni/jni_dh.c Outdated
Comment thread jni/jni_dh.c Outdated
@cconlon cconlon assigned rlm2002 and unassigned cconlon Apr 29, 2026
@cconlon cconlon merged commit 685938c into wolfSSL:master Apr 29, 2026
80 checks passed
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.

4 participants