Skip to content

ML-DSA Composite Signature Support#1109

Open
stenslae wants to merge 2 commits into
wolfSSL:masterfrom
stenslae:ml-dsa-hybrid-support-rebased
Open

ML-DSA Composite Signature Support#1109
stenslae wants to merge 2 commits into
wolfSSL:masterfrom
stenslae:ml-dsa-hybrid-support-rebased

Conversation

@stenslae

@stenslae stenslae commented Jul 16, 2026

Copy link
Copy Markdown
Member

Introduced support for ML-DSA composite signatures for hybrid post-quantum authentication.

  • Added ML-DSA44-Ed25519 as per draft-miller-sshm-mldsa44-ed25519-composite-sigs
  • Added ML-DSA44-ECDSA-P256, ML-DSA65-ECDSA-P384, ML-DSA65-ECDSA-P256, ML-DSA87-ED448, ML-DSA87-ECDSA-P384 as per draft-sun-ssh-composite-sigs-02

Added all sig types as auth options into the test echoservers, new CI tests, and interop tested mldsa44-ed25519 wtih openssh-portable.

@stenslae stenslae self-assigned this Jul 16, 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 #1109

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 examples/echoserver/echoserver.c
Comment thread src/internal.c
Comment thread examples/echoserver/echoserver.c
@stenslae
stenslae force-pushed the ml-dsa-hybrid-support-rebased branch 2 times, most recently from 9753775 to b1fec5b Compare July 20, 2026 16:46
@stenslae
stenslae force-pushed the ml-dsa-hybrid-support-rebased branch from b1fec5b to 5af710c Compare July 20, 2026 16:50
@stenslae
stenslae marked this pull request as ready for review July 20, 2026 16:53

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

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 examples/echoserver/echoserver.c
Comment thread examples/echoserver/echoserver.c
Comment thread examples/echoserver/echoserver.c
Comment thread examples/echoserver/echoserver.c
@stenslae
stenslae force-pushed the ml-dsa-hybrid-support-rebased branch from 5af710c to 1050ef1 Compare July 20, 2026 20:45
@stenslae
stenslae force-pushed the ml-dsa-hybrid-support-rebased branch from 1050ef1 to a1fddf0 Compare July 20, 2026 21:52
@stenslae
stenslae requested review from wolfSSL-Fenrir-bot and removed request for wolfSSL-Fenrir-bot July 20, 2026 22:29

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

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 wolfssh/internal.h Outdated
Comment thread wolfssh/internal.h Outdated
@stenslae
stenslae force-pushed the ml-dsa-hybrid-support-rebased branch from a1fddf0 to 2137136 Compare July 21, 2026 17:51
@stenslae
stenslae force-pushed the ml-dsa-hybrid-support-rebased branch from 2137136 to 145e2cf Compare July 21, 2026 18:15

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

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 src/internal.c Outdated
@stenslae
stenslae force-pushed the ml-dsa-hybrid-support-rebased branch from 145e2cf to 7228798 Compare July 21, 2026 18:23
Comment thread src/internal.c Outdated
@stenslae
stenslae force-pushed the ml-dsa-hybrid-support-rebased branch from 7228798 to 47dd078 Compare July 21, 2026 18:24

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

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
@stenslae
stenslae force-pushed the ml-dsa-hybrid-support-rebased branch 2 times, most recently from 26c7cfc to 96db1d0 Compare July 21, 2026 21:08

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

Scan targets checked: wolfssh-bugs, wolfssh-src

No new issues found in the changed files. ✅

@stenslae stenslae assigned wolfSSL-Bot and unassigned stenslae Jul 21, 2026
@stenslae
stenslae force-pushed the ml-dsa-hybrid-support-rebased branch 3 times, most recently from 9de220f to b7d471c Compare July 23, 2026 16:00

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

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 Outdated
Comment thread src/internal.c
Comment thread src/internal.c
Comment thread src/internal.c Outdated
@stenslae
stenslae force-pushed the ml-dsa-hybrid-support-rebased branch from b7d471c to a75a2ff Compare July 23, 2026 16:46

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

Scan targets checked: wolfssh-bugs, wolfssh-src
Findings: 2
1 finding(s) posted as inline comments (see file-level comments below)

Medium (1)

wc_MlDsaKey_ImportPubRaw result silently discarded by subsequent wc_MlDsaKey_MakeKeyFromSeed in GetOpenSshKeyMlDsaComposite

Function: GetOpenSshKeyMlDsaComposite
Category: Logic errors

The function calls wc_MlDsaKey_ImportPubRaw to import the ML-DSA public key from the OpenSSH key file, then immediately calls wc_MlDsaKey_MakeKeyFromSeed on the same key object. Per the ML-DSA specification, MakeKeyFromSeed derives a fresh key pair (both private and public halves) from the 32-byte seed, overwriting any previously imported public key material. The result of ImportPubRaw has no lasting effect on the final key state: the derived public key is used unconditionally, and the file-embedded public key is never compared against it. A key file whose stored public key does not match the seed would be silently accepted, and the mismatch would go undetected.

Recommendation: Remove the wc_MlDsaKey_ImportPubRaw call before MakeKeyFromSeed, as it has no effect. To preserve integrity validation, call wc_MlDsaKey_MakeKeyFromSeed first, then export the derived public key with wc_MlDsaKey_ExportPubRaw and compare it byte-for-byte against the pub bytes from the file. If they differ, return WS_KEY_FORMAT_E to flag a corrupted or mismatched key file.


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

Comment thread src/internal.c
@stenslae
stenslae force-pushed the ml-dsa-hybrid-support-rebased branch from a75a2ff to 11a13f2 Compare July 23, 2026 18:00
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 #1109

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
if (wc_ecc_sig_to_rs(asnSig, asnSigSz, rBuf, &rSz, sBuf,
&sSz) != 0) { result = -734; goto done; }
off = 0;
MlDsaTest_PutLen(tradSig + off, rSz); off += UINT32_SZ;

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] ECC test signature omits r/s pad bytes, diverging from production wire format · Missing edge-case coverage on a function the PR also changed

The test builds the ECC trad-signature as [rSz][rBuf][sSz][sBuf] with no leading-zero pad byte, but CompositeEccSign emits [rSz+rPad][0x00?][rBuf][sSz+sPad][0x00?][sBuf] when r[0]&0x80 or s[0]&0x80. CompositeEccVerify accepts both formats via wc_ecc_rs_raw_to_sig, so the test passes, but the padded case (the production format) is never exercised.

Fix: Mirror CompositeEccSign's padding logic: add rPad = (rBuf[0] & 0x80) ? 1 : 0 and emit [rSz+rPad][0x00?][rBuf] so the test exercises the actual production wire format.

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