Skip to content

ML-DSA Support#1048

Open
stenslae wants to merge 1 commit into
wolfSSL:masterfrom
stenslae:ml-dsa-support
Open

ML-DSA Support#1048
stenslae wants to merge 1 commit into
wolfSSL:masterfrom
stenslae:ml-dsa-support

Conversation

@stenslae

Copy link
Copy Markdown
Member
  • Implemented ML-DSA-44, ML-DSA-65, and ML-DSA-87 as public key authentication algorithms and their x509v3 certificate variants.

@stenslae stenslae self-assigned this Jun 22, 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 #1048

Scan targets checked: wolfssh-bugs, wolfssh-src

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

This review was generated automatically by Fenrir. Findings are non-blocking.

Comment thread tests/unit.c
Comment thread src/internal.c Outdated
Comment thread src/internal.c Outdated
Comment thread tests/unit.c

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

Scan targets checked: wolfssh-bugs, wolfssh-src

No new issues found in the changed files. ✅

@stenslae stenslae force-pushed the ml-dsa-support branch 2 times, most recently from 581d939 to 7602a43 Compare June 24, 2026 22: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 #1048

Scan targets checked: wolfssh-src
Failed targets: wolfssh-bugs

⚠️ Review incomplete — one or more scan targets failed before findings could be produced. See the Fenrir PR review detail page for logs.

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

Scan targets checked: wolfssh-src
Failed targets: wolfssh-bugs

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

This review was generated automatically by Fenrir. Findings are non-blocking.

Comment thread src/internal.c
Comment thread src/internal.c

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

Scan targets checked: wolfssh-bugs, wolfssh-src

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

This review was generated automatically by Fenrir. Findings are non-blocking.

Comment thread tests/unit.c Outdated

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 adds ML-DSA (44/65/87) public-key algorithm support to wolfSSH, including X.509v3 certificate variants, spanning key parsing, negotiation, signing/verification, key generation, and test coverage.

Changes:

  • Introduces ML-DSA algorithm IDs/macros and public keygen API (wolfSSH_MakeMlDsaKey), plus a new error code (WS_MLDSA_E).
  • Implements ML-DSA handling across key identification/parsing, KEX host-key signing/verification, and userauth publickey (plain + x509v3).
  • Adds unit and KEX tests for ML-DSA, and updates example/server + wolfsshd authorized_keys handling for larger PQ public keys.

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
wolfssh/keygen.h Adds ML-DSA key size/level macros and public ML-DSA keygen API declaration.
wolfssh/internal.h Adds ML-DSA compile-time gating, new algo IDs, key union support, and internal test hooks.
wolfssh/error.h Adds WS_MLDSA_E and updates WS_LAST_E.
src/keygen.c Implements ML-DSA key generation to DER via wolfCrypt.
src/internal.c Adds ML-DSA name/id mapping, negotiation ordering, key parsing/import/export, KEX signing/verify, and userauth (plain+x509) support.
src/ssh.c Extends key reading/ASN.1 handling to support ML-DSA public keys and OpenSSH format detection.
tests/unit.c Adds ML-DSA unit tests for keygen, IdentifyAsn1Key probing, and userauth (including cert-path cases).
tests/kex.c Adds KEX integration tests using ML-DSA host keys (44/65/87).
examples/echoserver/echoserver.c Adds ML-DSA host-key loading and conditional loading behavior based on -k list.
apps/wolfsshd/auth.c Expands authorized_keys line sizing and allowed key types to include ML-DSA (+ x509v3).

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

Comment thread examples/echoserver/echoserver.c
Comment thread src/internal.c
Comment thread wolfssh/keygen.h Outdated
Comment thread tests/kex.c Outdated
Comment thread tests/unit.c Outdated

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

Copilot reviewed 10 out of 13 changed files in this pull request and generated 2 comments.

Comment thread apps/wolfsshd/auth.c
Comment thread src/internal.c Outdated

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

Scan targets checked: wolfssh-src
Failed targets: wolfssh-bugs

⚠️ Review incomplete — one or more scan targets failed before findings could be produced. See the Fenrir PR review detail page for logs.

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

Scan targets checked: wolfssh-bugs, wolfssh-src

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

This review was generated automatically by Fenrir. Findings are non-blocking.

Comment thread src/internal.c
Comment thread src/internal.c
Comment thread src/internal.c
Comment thread src/internal.c

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

Scan targets checked: wolfssh-bugs, wolfssh-src

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

This review was generated automatically by Fenrir. Findings are non-blocking.

if (WSTRSTR(keyList, "mldsa-44") != NULL) {
mldsaSz = load_key_mldsa44(mldsaBuf, MLDSA_KEY_LOAD_BUF_SZ);
if (mldsaSz == 0)
ES_ERROR("Couldn't load ML-DSA-44 key file.\n");

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔵 [Low] mldsaBuf leaked on ML-DSA key load/use error paths · Resource leaks on error paths

ES_ERROR expands to WOLFSSL_RETURN_FROM_THREAD, exiting the thread immediately. Each ML-DSA load/use failure fires ES_ERROR after mldsaBuf (allocated at line 3202) and before the WFREE at line 3242, leaking the buffer.

Fix: Free mldsaBuf before each ES_ERROR in this block (or set a flag and free at a single exit point).

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.

3 participants