Skip to content

ML-DSA Smallmem Fixes - #11416

Merged
padelsbach merged 6 commits into
wolfSSL:masterfrom
stenslae:split/mldsa-smallmem-fixes
Oct 14, 2026
Merged

padelsbach merged 6 commits into
wolfSSL:masterfrom
stenslae:split/mldsa-smallmem-fixes

Conversation

@stenslae

@stenslae stenslae commented Sep 9, 2026

Copy link
Copy Markdown
Member

Description

Fixed runtime and math errors in ML-DSA when built with smallmem settings. Reordered scratch buffer allocations so that 32 and 64 bit integer arrays are aligned correctly and prevented 32 bit integer overflows before the NTT. Added a CI to prevent regressions.

Checklist

  • added tests
  • updated/added doxygen
  • updated appropriate READMEs
  • Updated manual and documentation

@stenslae stenslae self-assigned this Sep 9, 2026

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

Scan targets checked: wolfcrypt-src, wolfcrypt-bugs

Fenrir result: Approved ✅

No new issues found in the changed files.

Advisory only — this automated result does not count as a GitHub approval.

@stenslae stenslae assigned wolfSSL-Bot and unassigned stenslae Sep 9, 2026
@stenslae
stenslae force-pushed the split/mldsa-smallmem-fixes branch from 3476e10 to 3671eef Compare September 11, 2026 18:07

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

Scan targets checked: wolfcrypt-src, wolfcrypt-bugs

Fenrir result: Approved ✅

No new issues found in the changed files.

Advisory only — this automated result does not count as a GitHub approval.

@stenslae
stenslae force-pushed the split/mldsa-smallmem-fixes branch from 3671eef to cfdc3d3 Compare September 28, 2026 17:40

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

Scan targets checked: wolfcrypt-src, wolfcrypt-bugs, wolfssl-src, wolfssl-bugs
Coverage: 2 of 3 in-scope changed file(s) opened by the reviewer; not opened: wolfssl/wolfcrypt/wc_mldsa.h

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

@stenslae stenslae assigned stenslae and unassigned wolfSSL-Bot Sep 30, 2026
@stenslae
stenslae force-pushed the split/mldsa-smallmem-fixes branch from cfdc3d3 to 0317546 Compare September 30, 2026 18:59
@stenslae
stenslae requested review from wolfSSL-Fenrir-bot and a balanced review from Copilot September 30, 2026 18:59

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 review overview

🟡 Changes recommended

Failed key regeneration can leave a partially overwritten key marked usable with stale caches.

Review effort: Balanced
Findings: 1 High severity

Open (1)
What changed in this PR

Fixes ML-DSA small-memory alignment, inverse-NTT overflow, error propagation, and stale-cache regressions.

Changes:

  • Reorders scratch buffers and reduces coefficients before inverse NTT.
  • Adds fault injection and key-regeneration tests.
  • Expands small-memory CI/UBSan coverage.
File Description
wolfssl/​wolfcrypt/​wc_mldsa.h Declares the rejection-sampling test hook.
wolfcrypt/​src/​wc_mldsa.c Implements small-memory fixes and test instrumentation.
tests/​api/​test_mldsa.h Registers new ML-DSA tests.
tests/​api/​test_mldsa.c Tests regeneration, caches, and injected failures.
.wolfssl_known_macro_extras Registers new test macros.
.github/​workflows/​smallStackSize.yml Adds small-memory stack configurations.
.github/​configs/​pq-all.json Adds UBSan configurations across memory layouts.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread wolfcrypt/src/wc_mldsa.c Resolved

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

Scan targets checked: wolfcrypt-src, wolfcrypt-bugs, wolfssl-src, wolfssl-bugs
Coverage: 2 of 2 in-scope changed file(s) opened by the reviewer

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

@stenslae
stenslae force-pushed the split/mldsa-smallmem-fixes branch 2 times, most recently from ad39838 to 7110ccd Compare October 2, 2026 18:37
@stenslae
stenslae requested review from wolfSSL-Fenrir-bot and a balanced review from Copilot October 2, 2026 18:37

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 review overview

🔵 Needs a closer look

Cryptographic arithmetic and numerous compile-time memory configurations warrant final human validation despite strong regression coverage.

Review effort: Balanced
Findings: None

Resolved since last review (1)

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

Scan targets checked: wolfcrypt-src, wolfcrypt-bugs, wolfssl-src, wolfssl-bugs
Coverage: 1 of 2 in-scope changed file(s) opened by the reviewer; not opened: tests/api/test_mldsa.c

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

@stenslae stenslae assigned wolfSSL-Bot and unassigned stenslae Oct 2, 2026
@stenslae stenslae mentioned this pull request Oct 5, 2026
3 of 4 tasks

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.

🟡 Changes recommended

The new successful seeded-key-generation assertion fails under wrapped FIPS v7 builds.

1 open finding

🧠 Review effort: Balanced

Comment thread tests/api/test_mldsa.c Resolved

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

Scan targets checked: wolfcrypt-src, wolfcrypt-bugs, wolfssl-src, wolfssl-bugs
Coverage: 2 of 2 in-scope changed file(s) opened by the reviewer

Findings: 1
1 finding(s) posted as inline comments (see file-level comments below)

This review was generated automatically by Fenrir. Reported findings require changes before merge.

Review tier: Lite

Comment thread tests/api/test_mldsa.c Resolved
@stenslae
stenslae force-pushed the split/mldsa-smallmem-fixes branch from acb8c44 to a616394 Compare October 9, 2026 19:05
@stenslae
stenslae requested review from wolfSSL-Fenrir-bot and a balanced review from Copilot October 9, 2026 19:05

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.

🟡 Changes recommended

The new CI matrix does not exercise the small-code PRECALC_A reduction path.

1 open finding
1 resolved since last review

🧠 Review effort: Balanced

Comment thread .github/configs/pq-all.json Resolved

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

Scan targets checked: wolfssl-src, wolfssl-bugs
Unchanged since last review (not re-run): wolfcrypt-src, wolfcrypt-bugs
Coverage: 1 of 1 in-scope changed file(s) opened by the reviewer

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

@wolfSSL-Fenrir-bot
wolfSSL-Fenrir-bot dismissed their stale review October 9, 2026 19:10

Fenrir's latest completed scan found no issues; clearing the prior automated change request.

@stenslae stenslae removed their assignment Oct 12, 2026
Comment thread wolfcrypt/src/wc_mldsa.c Resolved
@stenslae
stenslae force-pushed the split/mldsa-smallmem-fixes branch from a616394 to b2f7047 Compare October 14, 2026 19:02
@stenslae
stenslae requested review from wolfSSL-Fenrir-bot and a balanced review from Copilot October 14, 2026 19:03

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.

🔵 Needs a closer look

Security-sensitive cryptographic arithmetic and configuration-dependent memory paths warrant final human review.

1 open finding
1 resolved since last review

🧠 Review effort: Balanced

Comment thread tests/api/test_mldsa.c Resolved

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

Scan targets checked: wolfcrypt-src, wolfcrypt-bugs, wolfssl-src, wolfssl-bugs
Coverage: 1 of 3 in-scope changed file(s) opened by the reviewer; not opened: tests/api/test_mldsa.c, wolfssl/wolfcrypt/wc_mldsa.h

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

@padelsbach padelsbach 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.

LGTM

@padelsbach padelsbach self-assigned this Oct 14, 2026
@padelsbach

Copy link
Copy Markdown
Contributor

jenkins retest this please boz-xeon5 issues

@padelsbach
padelsbach dismissed SparkiDev’s stale review October 14, 2026 20:47

comments addressed

@padelsbach
padelsbach merged commit c102b31 into wolfSSL:master Oct 14, 2026
425 of 426 checks passed
@stenslae
stenslae deleted the split/mldsa-smallmem-fixes branch October 16, 2026 18:29
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.

6 participants