Skip to content

Add crypto callbacks for LMS and XMSS#10380

Open
padelsbach wants to merge 5 commits intowolfSSL:masterfrom
padelsbach:lms-xmss
Open

Add crypto callbacks for LMS and XMSS#10380
padelsbach wants to merge 5 commits intowolfSSL:masterfrom
padelsbach:lms-xmss

Conversation

@padelsbach
Copy link
Copy Markdown
Contributor

@padelsbach padelsbach commented May 1, 2026

Description

Add struct fields and callbacks (MakeKey, Sign, Verify and SigsLeft) into existing LMS and XMSS code. Add wc_LmsKey_InitId and _InitLabel for PKCS11 compat. Added unit tests.

Testing

New unit tests

Checklist

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

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 #10380

Scan targets checked: wolfcrypt-bugs, wolfcrypt-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 wolfcrypt/src/wc_xmss.c Outdated
@padelsbach padelsbach force-pushed the lms-xmss branch 3 times, most recently from 49f1cc2 to 6673edd Compare May 4, 2026 17:47
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 4, 2026

MemBrowse Memory Report

No memory changes detected for:

@padelsbach
Copy link
Copy Markdown
Contributor Author

jenkins retest this please

Copy link
Copy Markdown
Contributor

@Frauschi Frauschi left a comment

Choose a reason for hiding this comment

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

A lot of minor things, mainly as the WiP patch I sent you was in a very rough state tbh (sorry for that).

Comment thread doc/LMS_XMSS_CryptoCb.md Outdated
Comment thread wolfssl/wolfcrypt/cryptocb.h Outdated
Comment thread wolfssl/wolfcrypt/cryptocb.h Outdated
Comment thread wolfcrypt/src/wc_lms.c Outdated
Comment thread wolfcrypt/src/wc_lms.c Outdated
Comment thread wolfcrypt/src/wc_xmss.c Outdated
Comment thread wolfcrypt/src/wc_xmss.c Outdated
Comment thread wolfcrypt/src/wc_xmss.c Outdated
Comment thread wolfcrypt/src/wc_lms.c Outdated
Comment thread wolfssl/wolfcrypt/wc_xmss.h Outdated
@Frauschi Frauschi assigned padelsbach and unassigned wolfSSL-Bot May 5, 2026
@padelsbach
Copy link
Copy Markdown
Contributor Author

jenkins retest this please

@Frauschi
Copy link
Copy Markdown
Contributor

Frauschi commented May 6, 2026

Ok, I have updates regarding the PKCS#11 "pre-hash" thing. It turns out that this is actually an error in their specification, which is already corrected in the current working drafts for the next version. The data passed to the sign and verify operations is indeed the whole message, not any pre-hashed digest!

After taking a more in-depth look into the algorithms, a simple pre-hash as proposed in the two helper methods of this PR also does not work and breaks spec compliance. Within both algorithms, the message is hashed together with the current state of the private key, which is not available in a CryptoCb / PKCS#11 setup on the host. Hence, this would have never worked properly anyway.

In total, this greatly simplifies our efforts, as the “normal” callbacks can directly be used for PKCS#11 as well. Hence, the two new helper methods for pre-hashing (wc_LmsKey_HashMsg() and wc_XmssKey_HashMsg()) can be removed completely. Furthermore, all the PKCS#11-related comments are unnecessary as a result.

Comment thread wolfcrypt/src/wc_lms.c Outdated
Comment thread wolfcrypt/src/wc_xmss.c Outdated
@Frauschi Frauschi assigned wolfSSL-Bot and unassigned padelsbach May 7, 2026
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.

4 participants