Skip to content

wolfHSM Hardening Fixes - #425

Open
aidangarske wants to merge 13 commits into
wolfSSL:mainfrom
aidangarske:fenrir-high-zeroize-bounds
Open

wolfHSM Hardening Fixes#425
aidangarske wants to merge 13 commits into
wolfSSL:mainfrom
aidangarske:fenrir-high-zeroize-bounds

Conversation

@aidangarske

Copy link
Copy Markdown
Member
F-4235, F-4329, F-4978, F-5139, F-5141, F-5142, F-5473, F-5474, F-5475, F-6029,
F-6030, F-6031, F-6207

@aidangarske aidangarske self-assigned this Jun 25, 2026
@aidangarske
aidangarske marked this pull request as ready for review June 25, 2026 22:21
@aidangarske
aidangarske force-pushed the fenrir-high-zeroize-bounds branch from efe02ca to d35e929 Compare June 29, 2026 16:45
@aidangarske
aidangarske requested a review from bigbrett June 29, 2026 16:47

@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 #425

Scan targets checked: wolfhsm-core-bugs, wolfhsm-crypto-bugs, wolfhsm-src

No new issues found in the changed files. ✅

@aidangarske
aidangarske requested review from wolfSSL-Bot and removed request for bigbrett July 15, 2026 21:10

@bigbrett bigbrett left a comment

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.

I'm medium on these force zero changes. In all of our currently supported transports, the transport buffer itself has to be trusted or the whole threat model falls apart, and the client's local comm buffers even more so. Zeroizing these here in light of these assumptions is overkill IMO and would be a bit of a performance hit. I think we need to have a uniform policy about when we require force zeroing of shared memory and apply it across the entire code base at once. Perhaps a build time configuration that would enable "strict" force zeroing where the server just clears the entirety of the comm buffers once received? But again, pretty sure this is overkill. @billphipps @rizlik thoughts?

@aidangarske

Copy link
Copy Markdown
Member Author

I'm medium on these force zero changes. In all of our currently supported transports, the transport buffer itself has to be trusted or the whole threat model falls apart, and the client's local comm buffers even more so. Zeroizing these here in light of these assumptions is overkill IMO and would be a bit of a performance hit. I think we need to have a uniform policy about when we require force zeroing of shared memory and apply it across the entire code base at once. Perhaps a build time configuration that would enable "strict" force zeroing where the server just clears the entirety of the comm buffers once received? But again, pretty sure this is overkill. @billphipps @rizlik thoughts?

@bigbrett, I am fine with doing it however you want seems like there is a lot of tradeoffs for each. Currently wolfssl does it like this but if we want to make a better design for wolfHSM that sounds good! Ill leave it for now till we decide

@aidangarske
aidangarske requested review from billphipps and rizlik July 21, 2026 18:16
Frauschi
Frauschi previously approved these changes Jul 23, 2026

@Frauschi Frauschi left a comment

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.

Besides the open discussion on the ForceZero policy for CommBuf data, the other changes LGTM.

(Only to give my two cents to the ForceZero discussion: I'm with @bigbrett on this. Have them in, but behind some kind of feature flag.)

@rizlik

rizlik commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

I'm medium on these force zero changes. In all of our currently supported transports, the transport buffer itself has to be trusted or the whole threat model falls apart, and the client's local comm buffers even more so. Zeroizing these here in light of these assumptions is overkill IMO and would be a bit of a performance hit. I think we need to have a uniform policy about when we require force zeroing of shared memory and apply it across the entire code base at once. Perhaps a build time configuration that would enable "strict" force zeroing where the server just clears the entirety of the comm buffers once received? But again, pretty sure this is overkill. @billphipps @rizlik thoughts?

@bigbrett I do think zeroing is worth even if the comm buffer is considered trusted, being zeroing more a defense in depth against possible client co-resident threats.

But yes having an performance opt-out guard is also a nice to have but more importantly I second the idea of doing that in a single place, probably when the client receives the response.
The problem I see here is that as this PR does the zeroing there is an implicit assumption that the transport cb send is done with the buffer the moment it returns.
If this is something we want to lock in the transport API, we should add it in the docs, otherwise, zeroing must happen at response time.

regarding zeroing at the server: this adds the requirement for a server to be able to write on the request buffer, while until now it can be mapped read-only.

Copilot AI review requested due to automatic review settings July 31, 2026 18:57

Copilot AI left a comment

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.

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

@aidangarske
aidangarske force-pushed the fenrir-high-zeroize-bounds branch from c3034b4 to 00d2dca Compare July 31, 2026 19:40
@aidangarske
aidangarske removed the request for review from wolfSSL-Bot July 31, 2026 19:52
@aidangarske
aidangarske force-pushed the fenrir-high-zeroize-bounds branch from 00d2dca to 7b91654 Compare July 31, 2026 19:59
@aidangarske

Copy link
Copy Markdown
Member Author

@bigbrett @rizlik, I added a WOLFHSM_CFG_DISABLE_CLIENT_COMM_ZEROIZE macro that is a specific performance opt out macro for the zeroization changes and has client communication-buffer zeroization by default. The cleanup is now centralized and preserve the in place response and DMA handling until parsing completes then the time sensitive fields are cleared . Let me know if this is what you guys where thinking

@aidangarske
aidangarske force-pushed the fenrir-high-zeroize-bounds branch from 7b91654 to 4df8529 Compare August 4, 2026 22:31
@aidangarske
aidangarske requested a review from bigbrett August 4, 2026 22:33
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.

7 participants