Skip to content

Fixes for DH agree buffer, digest/CMAC native context lifecycle, RSA-PSS default salt, PBKDF2 JNI errors - #298

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

cconlon wants to merge 5 commits into
wolfSSL:masterfrom
cconlon:fenrirOct14

Conversation

@cconlon

@cconlon cconlon commented Oct 14, 2026

Copy link
Copy Markdown
Member

This PR fixes 5 Fenrir issues:

  • F-15081: Size the wc_DhAgree() shared secret buffer to fit the key's prime.
  • F-15030: Free native digest contexts on re-init and release via MessageDigest.native_free().
  • F-15031: Re-key AesCmac after doFinal(), since wc_CmacFinal() frees the native context.
  • F-15032: Verify default-salt RSA-PSS with wc_RsaPSS_VerifyCheck() so the salt length follows the modulus bits.
  • F-15033: Stop the PBKDF2 JNI wrapper on GetByteArrayElements() failure and keep the pending exception.

@cconlon cconlon self-assigned this Oct 14, 2026
Copilot AI balanced review requested due to automatic review settings October 14, 2026 23:23

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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@wolfSSL-Fenrir-bot wolfSSL-Fenrir-bot 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.

Fenrir Automated Review — PR #298

Scan targets checked: wolfcrypt-jni-src, wolfcrypt-jni-bugs
Coverage: 10 of 32 in-scope changed file(s) opened by the reviewer; not opened: jni/include/com_wolfssl_wolfcrypt_Md5.h, jni/include/com_wolfssl_wolfcrypt_Sha.h, jni/include/com_wolfssl_wolfcrypt_Sha224.h, jni/include/com_wolfssl_wolfcrypt_Sha256.h, jni/include/com_wolfssl_wolfcrypt_Sha3.h, jni/include/com_wolfssl_wolfcrypt_Sha384.h, jni/include/com_wolfssl_wolfcrypt_Sha512.h, jni/jni_sha.c, src/main/java/com/wolfssl/wolfcrypt/Sha.java, src/main/java/com/wolfssl/wolfcrypt/Sha224.java and 12 more

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

@cconlon cconlon assigned rlm2002 and unassigned cconlon Oct 14, 2026
Comment thread jni/jni_md5.c

if (md5 != NULL) {
wc_Md5Free(md5);
XMEMSET(md5, 0, sizeof(Md5));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Claude: native_free_internal() zeroes the freed digest struct with plain XMEMSET instead of wc_ForceZero. The same pattern occurs at jni_sha.c:91,115,142,167,192,1883.

Did we want to match the pattern in jni_chacha.c, jni_aescts.c, jni_aesxts.c, jni_hmac.c?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Fixed, thanks

@rlm2002 rlm2002 assigned cconlon and unassigned rlm2002 Oct 23, 2026
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