Skip to content

unwrap bounds, CBIO error returns, key zeroization#365

Merged
cconlon merged 4 commits intowolfSSL:masterfrom
JeremiahM37:fenrir-fixes-4
May 4, 2026
Merged

unwrap bounds, CBIO error returns, key zeroization#365
cconlon merged 4 commits intowolfSSL:masterfrom
JeremiahM37:fenrir-fixes-4

Conversation

@JeremiahM37
Copy link
Copy Markdown
Contributor

Fixes F-3701, F-3702, F-3703, F-3704, F-3705, F-3706, F-3707

  • Unwrap copy-loop bounds: fix idx + ofst >= lengthidx >= length; report bytes actually copied, not stash size.
  • CBIO callbacks: return WOLFSSL_CBIO_ERR_GENERAL on missing cached jobject instead of 0 (graceful-close/zero-write).
  • Zero private key bytes: wc_ForceZero on release in X509_sign / X509_REQ_sign / X509_CRL_sign when isCopy.
  • Regression tests: two JUnit tests covering unwrap with ofst > 0.

@JeremiahM37 JeremiahM37 self-assigned this May 4, 2026
@JeremiahM37 JeremiahM37 force-pushed the fenrir-fixes-4 branch 2 times, most recently from 364e88c to 1b8dea1 Compare May 4, 2026 14:52
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 #365

Scan targets checked: wolfssljni-bugs, wolfssljni-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 targets JSSE unwrap correctness and native callback/key-handling hardening in wolfssljni. It updates SSLEngine offset handling, adjusts native CBIO error returns, and adds private-key buffer zeroization plus unwrap regression tests.

Changes:

  • Fixes WolfSSLEngine.unwrap() offset-based copy bounds and produced-byte accounting, including pending app-data replay.
  • Changes context-level native CBIO recv/send missing-object returns from 0 to WOLFSSL_CBIO_ERR_GENERAL.
  • Adds private-key buffer wiping in X509/CSR/CRL native sign paths and new JUnit regressions for unwrap with ofst > 0.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
src/test/com/wolfssl/provider/jsse/test/WolfSSLEngineTest.java Adds unwrap offset and pending-app-data regression tests.
src/java/com/wolfssl/provider/jsse/WolfSSLEngine.java Fixes unwrap buffer-index bounds and bytes-produced accounting.
native/com_wolfssl_WolfSSLCRL.c Adds JNI-copy zeroization in CRL signing cleanup.
native/com_wolfssl_WolfSSLContext.c Changes context-level CBIO missing-object returns to hard errors.
native/com_wolfssl_WolfSSLCertRequest.c Adds JNI-copy zeroization in CSR signing cleanup.
native/com_wolfssl_WolfSSLCertificate.c Adds JNI-copy zeroization in certificate signing cleanup.

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

Comment thread native/com_wolfssl_WolfSSLContext.c
Comment thread native/com_wolfssl_WolfSSLContext.c
Comment thread native/com_wolfssl_WolfSSLCertificate.c
Comment thread native/com_wolfssl_WolfSSLCertRequest.c
Comment thread native/com_wolfssl_WolfSSLCRL.c
@cconlon cconlon assigned JeremiahM37 and unassigned cconlon May 4, 2026
@JeremiahM37 JeremiahM37 assigned cconlon and unassigned JeremiahM37 May 4, 2026
@cconlon cconlon merged commit 1bea4be into wolfSSL:master May 4, 2026
169 of 170 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