Stateful Hash Signatures (LMS/XMSS)
Master hash-based digital signatures — LMS and XMSS standardized in NIST SP 800-208, with security based on hash function properties rather than new hardness assumptions.
Why this matters: LMS/XMSS require tracking signing state correctly, forever — reuse a one-time key by accident and forgery becomes feasible, so the key must be treated as compromised and retired.
Start here: Pick an LMS parameter set in LMS Key Generation: the Merkle tree structure, key sizes and signing capacity for that tree height are drawn, and with Live WASM mode on you can generate the key and sign.
For your role
- Developer / Engineer
- Explore LMS parameter sets and Merkle-tree structure, compare XMSS with LMS at equal security, simulate signing, key exhaustion and state loss, then generate real SLH-DSA keys over PKCS#11 for comparison.
- Security Architect
- The state-loss step shows the HSM refusing to rewind a key; the constraint behind it is that a reused one-time key voids the scheme, which decides where these keys may live. The Haystack coalition step shows distributed key control.
- Researcher / Academic
- The parameter explorer, the XMSS-versus-LMS comparison at equal security levels, and the Haystack coalition construction are the material to reproduce; the LMS tool runs cross-engine verification.
- Certification & Validation Engineer
- Start with 'What the lab tests' on the Learn tab: a FIPS 140-3 certificate for a module that signs with LMS or XMSS rests on four kinds of check, and the algorithm tests are only the first. Simulate signing, key exhaustion and a state rollback the HSM refuses, then compare XMSS with LMS at equal security: state management is what a module signing under SP 800-208 has to get right. Step 4 replays NIST's published LMS verification samples.
- IT Ops / DevOps
- The exhaustion run and the state-loss step show the operational failure mode and its control: state must be tracked correctly, forever, and the HSM refuses to let a backup restore it.
Why Stateful Hash-Based Signatures?
derive their security solely from the properties of cryptographic hash functions, which have a longer standardization history than or constructions. Unlike those schemes, they require no new hardness assumptions. requires its hash function to have second-preimage resistance (RFC 8554 §9); does not rely on the collision resistance of its hash functions but on weaker properties (RFC 8391).
“This recommendation specifies profiles of LMS, HSS, XMSS, and XMSS^MT that are appropriate for use by the U.S. Federal Government.”
— : Recommendation for Stateful Hash-Based Signature Schemes (October 2020)
Security relies only on hash function properties — no lattices, no codes, no isogenies.
SP 800-208 standardized LMS/HSS and XMSS/XMSS^MT for federal use.
NSA approves single-tree LMS and XMSS (not HSS or XMSS^MT) for firmware and software signing in national security systems, and prefers LMS with SHA-256/192; ML-DSA-87 is also allowed for this use. Phased timeline:
- • 2025: NSA 2022 category guidance (older schedule): prefer CNSA 2.0 for new software and firmware signing
- • 2030: CNSA 2.0: equipment that cannot support CNSA 2.0 phased out (31 December 2030, exceptions possible)
- • 2031: CNSA 2.0 algorithms mandated for national security systems (31 December 2031, unless otherwise noted)
Merkle Tree Signatures
The core idea is a of key pairs. Each leaf contains the hash of a unique OTS public key. The tree root is the overall public key. To sign, you use the next unused OTS leaf and provide an authentication path from that leaf to the root.
Green = next available OTS key. Each leaf can only be used ONCE.
Each OTS key pair (e.g., ) can sign exactly one message. Reusing an OTS key breaks that guarantee: each extra signature reveals more of the hash chains, which can enable forgeries.
The signature includes the OTS signature plus the sibling hashes needed to recompute the path from the used leaf to the root. Verifiers check that the path produces the known root.
Each OTS secret key is a set of random values. To sign, each value is hashed a number of times based on the message digest — revealing an intermediate chain value. The public key is the fully hashed end of each chain.
Signing message A reveals H³(sk); signing message B (different digit) reveals H&sup5;(sk). An attacker who sees both knows this chain from H³(sk) onward and can hash forward from there, but cannot go backward to sk or to H¹(sk) and H²(sk). The same holds for every chain, so the attacker can forge messages whose digits sit at or beyond the lowest revealed position in every chain, a set that grows with each further reuse. Two signatures do not guarantee that the whole private key or the seed is recovered, or that any chosen message can be forged, but nothing bounds the damage once a key has signed twice, so treat reuse as a compromise of the key. The checksum field prevents attackers from simply “advancing” the chain to forge messages with higher digit values.
LMS / HSS
The Leighton-Micali Signature Scheme (LMS) is defined in RFC 8554. It uses a single Merkle tree with LM-OTS (Leighton-Micali OTS) at the leaves. The Hierarchical Signature System (HSS) extends LMS with multiple levels of trees, where each non-leaf tree signs the root of the tree below it.
- • Tree heights: H = 5, 10, 15, 20, 25
- • Winternitz parameter: W = 1, 2, 4, 8
- • Max signatures = 2^H (32 to 33M)
- • Small public key: 24 bytes plus the hash output length – 48 bytes for the SHA-256/192 sets, 56 bytes for the SHA-256 sets (RFC 8554, SP 800-208) (not sourced in the Library)
- • Signature size: 1.3 – 9.3 KB depending on H, W (RFC 8554) (not sourced in the Library)
- • Up to 8 levels of LMS trees
- • Max signatures = 2^(H1 + H2 + ... + Hn)
- • Top-level tree signs sub-tree roots
- • Enables huge signing capacity
- • 2-level HSS with H10 trees = 2^20 = 1M sigs
Security note: W has zero impact on security level. It only controls the size / speed trade-off. Security is determined by the hash function and n (hash output length), not by W.
NIST SP 800-208 §8.1 requires key generation and signing within a hardware cryptographic module with no private keying material export. The profile specifies Level 3 or higher physical security and a non-modifiable or limited operational environment. Consult applicable CMVP implementation guidance for validation details. The workshop explains how to review state protection and what its demonstration cannot prove.
XMSS / XMSS^MT
The eXtended Merkle Signature Scheme (XMSS) is defined in RFC 8391. It shares the same Merkle tree approach as LMS but adds features like a bitmask-based tree hash construction (for multi-target attack resistance) and a different OTS scheme (WOTS+). XMSS^MT is the multi-tree variant, analogous to HSS.
| Feature | LMS / HSS | XMSS / XMSS^MT |
|---|---|---|
| Standard | RFC 8554, NIST SP 800-208 | RFC 8391, NIST SP 800-208 |
| Tree Hash | Simple iterative | Bitmask-based (multi-target resistant) |
| Implementation | Simpler, fewer parameters | More complex, stronger security proof |
| Key Generation | Fast | Slower (bitmask computation) |
| Signature Size | Slightly larger | Slightly smaller at same tree height |
| No | Not sourced in the Library | |
| Adoption | NSA CNSA 2.0 (single-tree LMS only), BSI | NSA CNSA 2.0 (single-tree XMSS only), |
XMSS internals: Two key constructions distinguish XMSS from LMS. An L-tree compresses the WOTS+ public key (up to 67 hash values) into a single leaf via an unbalanced binary tree. RAND_HASH randomizes each internal node by XOR’ing inputs with PRF-derived bitmasks before hashing, providing domain separation and multi-target attack resistance. These add ~4× the hash computations of LMS but yield a security proof that does not rely on the collision resistance of the hash functions (RFC 8391).
Both LMS and XMSS are approved by NIST SP 800-208. NSA CNSA 2.0 allows only the single-tree LMS and XMSS (HSS and XMSS^MT are not allowed) and prefers LMS with SHA-256/192; BSI TR-02102-1 recommends all SP 800-208 parameter sets of both families (not sourced in the Library).
The State Problem
The critical operational challenge with stateful schemes is that the signer MUST track which OTS keys have been used. Each leaf index can be used exactly once. If state is lost, reset, or duplicated, the same OTS key may be used twice — completely breaking the signature scheme.
If a one-time signature key is reused (signing two different messages with the same leaf), the signatures reveal chain values that let an attacker forge some signatures, and more with every further reuse. This is not a theoretical weakness — the one-time guarantee is gone and the key must be treated as compromised. There is no recovery; the entire key must be revoked.
- • Persisted to non-volatile storage before signing
- • Atomic — counter update and sign are one operation
- • Never cloned — VM snapshots, backups are dangerous
- • Never rolled back — no restoring from backup
- • Use HSMs with built-in monotonic counters
- • Reserve leaf ranges (batch allocation)
- • Write-ahead logging for state updates
- • Dedicated signing servers with no VM snapshots
| Property | LMS / XMSS | SLH-DSA (FIPS 205) |
|---|---|---|
| State required | Yes — monotonic counter | No — fully stateless |
| Signature size | Small (1.3 – 9 KB) | Large (8 – 49 KB) |
| Signing speed | Fast | Slow (many hash rounds) |
| Max signatures | Bounded by 2^H (plan ahead) | FIPS 205 parameter sets meet their security categories when each key pair signs at most 2^64 messages; no leaf counter |
| CNSA 2.0 | Approved for firmware/software signing (LMS SHA-256/192 recommended; ML-DSA-87 also allowed) | Not included in CNSA 2.0 |
| Best for | Firmware, code signing, secure boot (controlled) | TLS, general-purpose, distributed signing |
LMS/XMSS and SLH-DSA are complementary, not competing. Stateful schemes are typically more compact in signature and key sizes than stateless alternatives like SLH-DSA.
What the lab tests
A certificate for a module that signs with LMS or XMSS rests on four different kinds of check. The algorithm tests are only the first.
- • ACVP has an LMS specification with three modes: keyGen, sigGen and sigVer. Each has one test type, AFT (Algorithm Functional Test).
- • keyGen: the implementation must “generate a key pair based on an approved tree structure”. sigGen: it must “generate valid signatures based on the ACVP provided message”. sigVer: it must “determine the validity of the signature given the tree structure, key, and message”.
- • A vendor registers LMS modes and LM-OTS modes by hash, tree height (for example LMS_SHA256_M24_H5 through LMS_SHA256_M32_H25) and Winternitz setting (W1, W2, W4, W8). The pair must follow SP 800-208 Section 4, “namely M = N, and the hash is the same”.
- • On NIST's CAVP prerequisites page, LMS keyGen, sigGen and sigVer each list “All hash functions and XOFs used.”
- • Not covered, in the specification's words: “ACVP does not test the inability of an implementation to export a private key. ACVP does not provide any guarantees on the inability to reuse private OTS pairs of an implementation.”
- • XMSS, XMSS^MT and HSS: no ACVP specification is published for them. The ACVP index at pages.nist.gov/ACVP lists LMS, ML-DSA, ML-KEM and SLH-DSA as its post-quantum entries (checked 23 October 2026). IG C.N, last modified 10 September 2024, says CAVP tests are “available for LMS but not yet for XMSS, HSS, or XMSSMT”. IG C.O, of the same date, records that “Support for the LMS scheme was added to the ACVTS production server in April 2023” and that “the other schemes (including HSS) remain untestable by the CAVP as of the last modified date of this IG”.
- • The module runs cryptographic algorithm self-tests (CASTs). IG 10.3.A applies its requirements “prior to the first operational use of the cryptographic algorithm”.
- • A module that implements LMS signature generation must also implement key generation and have CASTs for both. The same holds for HSS, XMSS and XMSS^MT. Signature verification needs its own CAST. HSS builds on LMS, so the HSS CASTs cover the LMS ones; XMSS^MT likewise covers XMSS.
- • Hash functions: a CAST for SHA-256 is required; for SHA-256/192 if it is implemented without SHA-256; for SHAKE256/256; and for SHAKE256/192 if it is implemented without SHAKE256/256. These can be satisfied as part of the LMS, HSS, XMSS or XMSS^MT CASTs.
- • Testing cost depends on tree height, so the CASTs only need to exercise the smallest (or any single) supported parameter set. “It is also not necessary to test both LM-OTS + LMS modes”, but a CAST covering the different underlying SHA or SHAKE functions is still required.
- • Every generated key pair also needs a pairwise consistency test. For SP 800-208 keys it “may be limited to confirming the same key identifier (I in the case of LMS, SEED in the case of XMSS and PK.SEED for SLH-DSA) is shared by the resulting public and private key following generation”.
- • SP 800-208 §8.1: “Implementations of the key generation and signature algorithms in this document shall only be validated for use within hardware cryptographic modules.” The module must also provide Level 3 or higher physical security and a non-modifiable or limited operational environment, operate only in an approved mode with no bypass mode, not allow export of private keying material, and keep the entropy source of its random bit generator inside its physical boundary.
- • Firmware modules (IG C.N, resolution 9): where the hardware components of a certified module meet the Level 3 physical security and the non-modifiable or limited operational environment, “it is not required that modules are module type: 'hardware' and may separately include modules of type 'firmware' and 'hybrid firmware'”. Software and hybrid software modules are excluded.
- • Signature verification only (IG C.N, resolution 1): the §8.1 requirements “exclusively apply to modules supporting HBS key generation and signature generation”. Modules that only support signature verification “need to comply with requirements from section 8.2 of SP 800-208, but do not need to meet requirements from section 8.1”.
- • Where ACVP is silent, the lab checks. IG C.N prohibits importing private keys, including “importing private keys as a restore operation from a backup” (resolution 3), seeding key generation from an external entropy source outside the hardware perimeter (resolution 5), and creating “independent copies of keys internal to the cryptographic boundary” (resolution 7). The vendor “shall justify the implementation strategy taken to eliminate the possibility of OTS private key re-use”, and “Documentation review in isolation is not sufficient”: the tester confirms the module prevents the use of an OTS key to generate a digital signature more than one time, cannot create an independent copy of an HBS key, and, if it stores keys in non-volatile memory, updates the leaf index there before exporting a signature value or accepting a request to sign another message (resolution 12).
- • LMS and XMSS (NIST SP 800-208) are listed for digitally signing firmware and software: “All parameters approved for all classification levels. LMS SHA-256/192 is recommended.” “The multi-tree algorithms HSS and XMSSMT are not allowed.” SLH-DSA “is not part of CNSA and is not approved for any use in NSS”.
| Who | What the FAQ says |
|---|---|
| A product that only verifies signatures | “Signature verification is expected to be performed by code that has been validated by NIST's Cryptographic Algorithm Validation Program (CAVP).” “If your product is only verifying signatures, CAVP testing is all that is required.” |
| A signer that is a national security system (NSS) | “Code sources and signature generation processes (signers) that are NSS are required to produce signatures according to NIST SP 800-208, which requires hardware validated by NIST's Cryptographic Module Validation Program (CMVP), or via other NSA guidance. Waivers for this will not be granted.” |
| A signer that is not itself an NSS (for example a commercial vendor's build environment) | “Those signers are expected to use code in their signature generation processes that is at least at the same operational quality as the code being put on the device, but the only part NSA will validate is that the signature verification code on the device passes CAVP.” |
| A product evaluated under a NIAP Protection Profile | Where signing occurs outside the Target of Evaluation boundary, Protection Profile requirements only apply to signature verification: “if only signature verification is being performed only CAVP validation (not CMVP) will be expected to meet CNSA 2.0 for such products.” |
The FAQ adds: “To avoid weakening the security of these signatures, one should implement signing and state management in hardware, such as an HSM. Backup flows, which may involve transferring keys between modules, must prevent state re-use.”
Sources: NIST ACVP draft specification for LMS and CAVP prerequisites page (October 2026); CMVP Implementation Guidance for FIPS PUB 140-3 (IG 10.3.A, C.N; document updated 19 August 2026); NIST SP 800-208 (October 2020) §8.1; NSA CNSA 2.0 FAQ version 2.2. Check the current versions: guidance and test coverage change. How labs run these steps end to end: FIPS 140-3 Certification and ACVP Lab Workflow.
Which scheme for which use
Each row shows one example parameter set and the number of signatures it can ever make. Every signature uses up one one-time key, so that number is a hard limit; estimate what your use needs and pick a set that covers it. The record of which keys are used (the state) must stay inside the signing hardware module; a device that only verifies keeps none.
Firmware signing
- Parameter set
- LMS, one tree, height 20
- Signatures
- 1,048,576
- State
- Signing HSM, the device holds none.
- CNSA 2.0
- LMS allowed for firmware and software, SHA-256/192 recommended, HSS not allowed.
Code signing
- Parameter set
- XMSS-SHA2_20_256, one tree, height 20
- Signatures
- 1,048,576
- State
- Signing HSM.
- CNSA 2.0
- XMSS allowed for software, XMSS^MT not allowed.
Secure boot
- Parameter set
- LMS, one tree, height 10
- Signatures
- 1,024
- State
- The vendor's signing HSM, the device holds only the public key.
- CNSA 2.0
- LMS allowed; note that a larger Winternitz w makes signatures smaller but slows key generation, signing and verification (RFC 8554).
Document signing
- Parameter set
- XMSS^MT-SHA2_40/4_256, total height 40 in 4 layers
- Signatures
- 1,099,511,627,776
- State
- Signing HSM, backups must prevent state re-use (CNSA 2.0 FAQ p. 12).
- CNSA 2.0
- XMSS^MT not allowed, LMS and XMSS approved for firmware and software only, ML-DSA-87 approved for every use.
Timestamping
- Parameter set
- XMSS^MT-SHA2_60/6_256, total height 60 in 6 layers
- Signatures
- 1,152,921,504,606,846,976
- State
- Signing HSM, backups must prevent state re-use (CNSA 2.0 FAQ p. 12).
- CNSA 2.0
- XMSS^MT not allowed, LMS and XMSS approved for firmware and software only, ML-DSA-87 approved for every use.
| Use | Parameter set | Signatures | State | CNSA 2.0 |
|---|---|---|---|---|
| Firmware signing | LMS, one tree, height 20 | 1,048,576 | Signing HSM, the device holds none. | LMS allowed for firmware and software, SHA-256/192 recommended, HSS not allowed. |
| Code signing | XMSS-SHA2_20_256, one tree, height 20 | 1,048,576 | Signing HSM. | XMSS allowed for software, XMSS^MT not allowed. |
| Secure boot | LMS, one tree, height 10 | 1,024 | The vendor's signing HSM, the device holds only the public key. | LMS allowed; note that a larger Winternitz w makes signatures smaller but slows key generation, signing and verification (RFC 8554). |
| Document signing | XMSS^MT-SHA2_40/4_256, total height 40 in 4 layers | 1,099,511,627,776 | Signing HSM, backups must prevent state re-use (CNSA 2.0 FAQ p. 12). | XMSS^MT not allowed, LMS and XMSS approved for firmware and software only, ML-DSA-87 approved for every use. |
| Timestamping | XMSS^MT-SHA2_60/6_256, total height 60 in 6 layers | 1,152,921,504,606,846,976 | Signing HSM, backups must prevent state re-use (CNSA 2.0 FAQ p. 12). | XMSS^MT not allowed, LMS and XMSS approved for firmware and software only, ML-DSA-87 approved for every use. |
Sources: NIST SP 800-208, RFC 8554, RFC 8391, NSA CNSA 2.0 FAQ v2.2.
Explore LMS and XMSS key generation, compare parameter sets, and simulate state management.
Your comments on Stateful Hash Signatures(0)
Stored on this device only. A comment never counts toward your progress.
Related modules
- Merkle Tree CertificatesSame track · Software Infrastructure · Shares LMS/XMSS, NIST SP 800-208
- The PQC Algorithms: How They Work and How to ChooseSame migration phase · Shares LMS/XMSS, NIST SP 800-208
- Cryptographic APIs & Developer LanguagesSame track · Software Infrastructure · Same migration phase · Shares NIST SP 800-208
- Code SigningShares LMS/XMSS, NIST SP 800-208
Related resources
- Page: OpenSSL StudioOpenSSL StudioRun LMS/XMSS operations with OpenSSL 3.x WASM
- Page: AlgorithmsAlgorithm ReferenceDetailed specs for all PQC algorithms including LMS and XMSS
- Page: LibrarySoftware LibraryPQC-ready libraries and tools with stateful signature support
- Page: LibraryRFC 10033: Hash-Based Signatures: State and Backup ManagementPractical guidance on state, backup, and recovery for LMS/XMSS deployments
- Library documentRFC 10033: Hash-Based Signatures: State and Backup Management
- Library documentImplementation Guidance for FIPS 140-3 and the Cryptographic Module Validation Program
- Library documentCircle's Post-Quantum Security Roadmap: Securing blockchains smart contracts and digital assets for the quantum era
- Library documentAdditional Parameter Sets for HSS/LMS Hash-Based Signatures
- Library documentUse of HSS and XMSS Hash-Based Signature Algorithms in X.509 PKI
In the Industry Landscape
- Automotive / Connected VehiclesBy protocol · ECU secure boot & OTA update signing
- Cross-IndustryBy protocol · Software & code signing
- Cryptocurrency / BlockchainBy protocol · Validator & consensus signatures
- Government & DefenseBy protocol · National security systems — software & firmware signing (CNSA 2.0) · NSS product evaluation timelines (NIAP Policy #33)
- Healthcare / PharmaceuticalBy protocol · Medical-device firmware & authentication
- Hardware Security ModulesBy protocol · PKCS#11 / KMIP interface migration · Root-of-trust & firmware signing · Certified PQC-capable HSM product · +1 more
- Internet of Things (IoT)By protocol · Firmware update signing (SUIT/COSE)
- Legal / Notary / eSignatureBy protocol · Qualified e-signatures (AdES) · Qualified timestamping (RFC 3161)
- Government Identity & Travel DocumentsBy protocol · ePassports and machine-readable travel documents (eMRTD, ICAO Doc 9303)
- Semiconductors / Secure ElementsBy protocol · Common Criteria certification of security ICs and dedicated security components · PQC in security controllers, TPMs & microcontrollers (chip-vendor statements)
Check your understanding
16 questions on Stateful Hash Signatures, each with its answer and the reason.
Take the quizProduction Tool Capabilities & Verification ChecklistFirmware Security Engineers & HSM Architects
Capabilities to require in your production tools:
- NIST SP 800-208 compliant `LMS/HSS` and `XMSS/XMSS^MT` signing inside a hardware security module that guarantees monotonic, non-rewindable one-time signature (OTS) index state.
- Zero-state-reuse enforcement: hardware refusal to sign if NVRAM state persistence fails or if key-tree exhaustion is reached.
- Strict prohibition of private-key export or VM snapshot cloning for stateful hash-based signing keys.
How to evaluate in your environment
Test OTS leaf-index increment persistence across power cycles and verify hard failure when tree capacity (2^h signatures) is exhausted in a lab HSM.
Production evidence to collect
HSM state-counter audit log, SP 800-208 parameter set configuration (`H`, `W`), and backup/clone prevention verification record.
Completing this Hub module and its browser-based sample exercises teaches the technical and governance decision criteria for your role; it does not test, validate, or certify your deployed production systems.
Record evidence for your environment
Identify the tested build and configuration. Use reference IDs for observations. For a proposed exclusion, record the system boundary or rule and why it excludes this build.
Evidence missing. 0 of 3 requirements have a reference or scope rationale.
Learning module content can be inaccurate. Please double-check its information. Report inaccuracies in PQC Today GitHub Discussions.