Skip to content

SLH-DSA fixes#10698

Merged
JacobBarthelmeh merged 1 commit into
wolfSSL:masterfrom
Frauschi:slhdsa_fixes
Jun 17, 2026
Merged

SLH-DSA fixes#10698
JacobBarthelmeh merged 1 commit into
wolfSSL:masterfrom
Frauschi:slhdsa_fixes

Conversation

@Frauschi

Copy link
Copy Markdown
Contributor

Zeroization:

  • Add missing ForceZero on the PRF outputs and WOTS+ chain state that hold secret key material.
  • Route the WOTS sign leaf through a temp so secret chain values never touch the public signature buffer.
  • Add SLHDSA_SHAKE_X4_STATE_W so buffer and wipe sizes stay in sync.

Leak / alloc-failure fixes:

  • Fix chain_idx_x4 returning on SAVE_VECTOR_REGISTERS2 failure without freeing state/fixed (memory leak, and the secret was left unzeroized); break to the cleanup path instead.
  • Guard all function-scope wipes with WC_VAR_OK to avoid a NULL deref when an allocation fails under WOLFSSL_SMALL_STACK.

Zeroization:
- Add missing ForceZero on the PRF outputs and WOTS+ chain state that hold
  secret key material.
- Route the WOTS sign leaf through a temp so secret chain values never touch
  the public signature buffer.
- Add SLHDSA_SHAKE_X4_STATE_W so buffer and wipe sizes stay in sync.

Leak / alloc-failure fixes:
- Fix chain_idx_x4 returning on SAVE_VECTOR_REGISTERS2 failure without freeing
  state/fixed (memory leak, and the secret was left unzeroized); break to the
  cleanup path instead.
- Guard all function-scope wipes with WC_VAR_OK to avoid a NULL deref when an
  allocation fails under WOLFSSL_SMALL_STACK.
@Frauschi Frauschi self-assigned this Jun 16, 2026
@Frauschi Frauschi assigned wolfSSL-Bot and unassigned Frauschi Jun 16, 2026
@Frauschi Frauschi added the For This Release Release version 5.9.2 label Jun 17, 2026

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.

Pull request overview

This PR hardens the SLH-DSA implementation by tightening secret handling (zeroization and avoiding secret material landing in public output buffers) and by fixing error-path cleanup for AVX2/x4 SHAKE helpers when allocations or vector-register save operations fail.

Changes:

  • Add missing ForceZero() wipes for secret PRF outputs and WOTS+ chain state, with WC_VAR_OK() guards where allocation can fail under WOLFSSL_SMALL_STACK.
  • Fix SAVE_VECTOR_REGISTERS2() failure handling in x4 chain iteration helpers to go through cleanup (avoid leaks / skipped wipes).
  • Introduce SLHDSA_SHAKE_X4_STATE_W as a single constant for x4 SHAKE state sizing and use a temp buffer in WOTS signing so intermediate secret values don’t touch the signature buffer.

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

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

Scan targets checked: wolfcrypt-bugs, wolfcrypt-src

No new issues found in the changed files. ✅

@JacobBarthelmeh JacobBarthelmeh merged commit 7aed5ac into wolfSSL:master Jun 17, 2026
304 checks passed
@Frauschi Frauschi deleted the slhdsa_fixes branch June 26, 2026 09:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

For This Release Release version 5.9.2

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants