ML-DSA Support#1048
Conversation
stenslae
commented
Jun 22, 2026
- Implemented ML-DSA-44, ML-DSA-65, and ML-DSA-87 as public key authentication algorithms and their x509v3 certificate variants.
wolfSSL-Fenrir-bot
left a comment
There was a problem hiding this comment.
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.
wolfSSL-Fenrir-bot
left a comment
There was a problem hiding this comment.
Fenrir Automated Review — PR #1048
Scan targets checked: wolfssh-bugs, wolfssh-src
No new issues found in the changed files. ✅
581d939 to
7602a43
Compare
wolfSSL-Fenrir-bot
left a comment
There was a problem hiding this comment.
Fenrir Automated Review — PR #1048
Scan targets checked: wolfssh-src
Failed targets: wolfssh-bugs
wolfSSL-Fenrir-bot
left a comment
There was a problem hiding this comment.
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.
wolfSSL-Fenrir-bot
left a comment
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
8004066 to
197c0de
Compare
wolfSSL-Fenrir-bot
left a comment
There was a problem hiding this comment.
Fenrir Automated Review — PR #1048
Scan targets checked: wolfssh-src
Failed targets: wolfssh-bugs
wolfSSL-Fenrir-bot
left a comment
There was a problem hiding this comment.
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.
wolfSSL-Fenrir-bot
left a comment
There was a problem hiding this comment.
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"); |
There was a problem hiding this comment.
🔵 [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).