Skip to content

Add support for LMS and XMSS#352

Open
padelsbach wants to merge 1 commit into
wolfSSL:mainfrom
padelsbach:lms-xmss
Open

Add support for LMS and XMSS#352
padelsbach wants to merge 1 commit into
wolfSSL:mainfrom
padelsbach:lms-xmss

Conversation

@padelsbach
Copy link
Copy Markdown
Contributor

@padelsbach padelsbach commented May 4, 2026

Requires wolfSSL/wolfssl#10380 to be merged first (done).

Adds support for "stateful" PQC using crypto callbacks added to wolfssl.

@padelsbach padelsbach force-pushed the lms-xmss branch 2 times, most recently from e01c4e8 to 322c2ba Compare May 11, 2026 16:52
@padelsbach padelsbach force-pushed the lms-xmss branch 2 times, most recently from d524cee to c9dad02 Compare May 18, 2026 21:59
@padelsbach
Copy link
Copy Markdown
Contributor Author

wolfSSL/wolfssl#10488 is required for CI to pass

@padelsbach padelsbach force-pushed the lms-xmss branch 2 times, most recently from d104594 to 2c5db59 Compare May 19, 2026 18:36
@padelsbach padelsbach assigned wolfSSL-Bot and unassigned padelsbach May 19, 2026
@padelsbach padelsbach marked this pull request as ready for review May 19, 2026 18:50
Copy link
Copy Markdown

@wolfSSL-Fenrir-bot wolfSSL-Fenrir-bot left a comment

Choose a reason for hiding this comment

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

Fenrir Automated Review — PR #352

Scan targets checked: wolfhsm-core-bugs, wolfhsm-crypto-bugs, wolfhsm-src

Findings: 3
3 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/wh_server_crypto.c Outdated
Comment thread src/wh_server_crypto.c Outdated
Comment thread src/wh_server_crypto.c
Comment thread src/wh_server_crypto.c Outdated
Comment thread src/wh_server_crypto.c Outdated
Comment thread src/wh_server_crypto.c
Copy link
Copy Markdown

@wolfSSL-Fenrir-bot wolfSSL-Fenrir-bot left a comment

Choose a reason for hiding this comment

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

Fenrir Automated Review — PR #352

Scan targets checked: wolfhsm-core-bugs, wolfhsm-crypto-bugs, wolfhsm-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/wh_server_crypto.c Outdated
Comment thread src/wh_server_crypto.c Outdated
Comment thread src/wh_server_crypto.c Outdated
Comment thread src/wh_server_crypto.c Outdated
Copy link
Copy Markdown

@wolfSSL-Fenrir-bot wolfSSL-Fenrir-bot left a comment

Choose a reason for hiding this comment

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

Fenrir Automated Review — PR #352

Scan targets checked: wolfhsm-core-bugs, wolfhsm-crypto-bugs, wolfhsm-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 wolfhsm/wh_crypto.h

/* Restore an XmssKey from a byte sequence. The caller must pass a key that
* has been wc_XmssKey_Init'd. The function calls wc_XmssKey_SetParamStr
* (which allocates key->sk) and copies pub and sk from the blob. */
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] XmssDeserializeKey header doc contradicts implementation · Incorrect error handling

The header comment claims wc_XmssKey_SetParamStr allocates key->sk and that the function copies pub and sk from the blob, but the implementation in src/wh_crypto.c:651 only copies pk and notes that sk is loaded later via Reload/bridge ReadCb. Callers following the documented contract will get an unpopulated sk.

Fix: Update the header doc to state that only pk is restored and that sk must be populated by wc_XmssKey_Reload against the bridge ReadCb.

Comment thread src/wh_server_crypto.c
if (ret == 0) {
ret = wc_LmsKey_GetPubLen(key, &pubLen32);
}
if (ret == 0 && req.pub.sz < pubLen32) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟠 [Medium] LMS/XMSS keygen DMA commits key to NVM before validating client pub buffer size, enabling orphan-key NVM exhaustion · NV storage vulnerabilities

_HandleLmsKeyGenDma (and _HandleXmssKeyGenDma at line 6560) calls wh_Server_KeystoreCommitKey and consumes a fresh unique keyId before checking req.pub.sz < pubLen32. On undersized pub buffer the response is suppressed (only the rc header is sent), so the client never learns the keyId of the now-persisted, unreachable key, letting an authenticated client exhaust NVM via repeated failed-but-committed keygens.

Fix: Validate req.pub.sz >= pubLen32 (and resolve the DMA pub address) before calling wh_Server_LmsKeyCacheImport/KeystoreCommitKey in both _HandleLmsKeyGenDma and _HandleXmssKeyGenDma.

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