← Back to section · Post-Quantum Cryptography

Stateful Hash-Based Signatures: The State Engineering of XMSS and LMS

Why XMSS (RFC 8391) and LMS (RFC 8554) were standardized first, why their one-time-key state must never repeat, the usage boundaries of SP 800-208, and state management for distributed signing and backup scenarios.

Published 22 November 2026 · 5 min read · PQ Frontier

Stateful Hash-Based Signatures: The State Engineering of XMSS and LMS
AI-generated site artwork
Video explainer · Digital signature schemes

While the ML-DSA family was still moving through the selection process, stateful hash-based signatures had quietly entered standards and products: XMSS was written into RFC 8391, LMS into RFC 8554, and in 2020 NIST published SP 800-208 approving both for scenarios such as firmware and software signing. They are the most “honest” post-quantum signatures — hash functions only, no new mathematical assumptions. Rather than repeating the comparison with stateless schemes (this site’s slh-dsa subcategory has a dedicated article), this piece focuses on one engineering question: how should that intimidating “state” actually be managed?

One-time keys: where the state comes from

Both XMSS and LMS are built on Merkle trees: each leaf of the tree is a one-time signature (OTS) key pair, and the tree root is the public key. The mathematics of one-time keys dictates that each may sign safely exactly once — sign two different messages with the same OTS key and an attacker can combine the two signatures to forge new ones. The signer must therefore remember precisely “the next unused leaf index”, incrementing the counter with every signature. That counter is the state; the moment state rolls back or is duplicated, the security assumption collapses on the spot.

The two schemes differ mainly in tree organization: LMS (with its multi-tree variant HSS) is plain in structure and simple to implement, and is the branch more widely adopted in hardware and firmware ecosystems; XMSS (with XMSS^MT) offers more parameter shapes between a single large tree and multiple layers. SP 800-208 confines both to scenarios where the number of signatures is controllable and the signing environment is controlled — an explicit boundary given by the standard, not a suggestion.

The three essentials of state management

First, the counter must live somewhere it cannot roll back. Keeping state in an ordinary file and trusting the application to flush it is the most common mistake: process crashes, virtual-machine snapshot restores and primary/standby failovers can all silently rewind the counter. The robust pattern is to make signing and state update happen inside the same rollback-resistant boundary — counters inside an HSM or secure element are the industry mainstream; a signing service should at minimum persist state before releasing the signature.

Second, multiple signing machines should partition, not share. Building distributed consensus over a whole tree’s counter for horizontal scaling is both complex and fragile; the standard practice is to split by subtree: the multi-layer structures of HSS/XMSS^MT naturally let different subtrees be assigned to different signing machines, each monotonic within its own range and never interfering. Total signature capacity scales as two to the power of tree height, so planning the layers against business volume suffices.

Third, backup and disaster recovery must treat state as part of the data. Backing up the private seed but not the current counter position manufactures a state-reuse incident at restore time with your own hands. The recovery procedure must guarantee that a restored signer’s state is no lower than the state used by any signature already issued. A system that cannot guarantee this should generate a fresh key and go through public-key distribution again, rather than keep signing with unknown state.

Signature budgets and tree planning

Stateful deployment starts with arithmetic: how many signatures can one key produce in its life? The total is set by tree height — a tree of height h has 2^h leaves, and when they are spent the key must retire. Multi-layer structures (HSS, XMSS^MT) multiply the heights of the layers, reaching totals that are practically inexhaustible, but each added layer grows signature size and generation time.

Planning works backwards: estimate annual signing volume and intended key lifetime, multiply out the total demand, then choose tree heights with ample headroom. Treat “key rollover” as a routine operational event by design — how the new public key is distributed, and how old signatures remain verifiable long after rollover, belong in the procedure, not in improvisation. Firmware deserves special attention on the verification side: devices run in the field for a decade, so verification code must still handle packages signed under retired keys ten years on — key retirement is not verification retirement.

A hidden cost is key-generation time: generating large trees and precomputing subtrees takes time and storage, and an HSM’s compute ceiling directly caps the usable tree height. Measuring these numbers during selection is the least glamorous and most necessary step in landing a stateful scheme.

Who it suits

The scenario profile SP 800-208 draws is clear: predictable signature counts, a controlled signing environment, long-lived verifiers — firmware signing is the textbook match, with code signing and root key ceremonies next. Conversely, open-ended general signing services and multi-tenant systems that cannot guarantee state discipline should not touch stateful schemes. In the right scenario, XMSS and LMS are the most conservatively-assumed post-quantum signatures deployable today; in the wrong one, no assumption, however conservative, rescues a reused leaf.

One operational dividend deserves note: stateful schemes give auditors something stateless ones cannot — the signature count itself is an auditable ledger. If the counter’s current value, the historical signing records and the subtree assignment table agree, the key’s usage history is self-consistent; if they disagree, state management has a problem and signing should stop for investigation. Folding that ledger into routine audit turns “state discipline” from a developer’s good intention into organizational process — the operational landing point of usage boundaries like SP 800-208’s.

Vendor selection has a related practical point: HSMs and signing devices that support XMSS/LMS and keep their counters in rollback-resistant storage differ widely by model. Procurement should ask “how is state stored” as a veto question — does the counter increase monotonically inside the device, how are cloning and restore handled, and does a firmware upgrade touch the state region? A device that cannot answer these three questions, however cheap, does not belong in a firmware signing chain.

Tags: XMSSLMSStateful SignaturesSP 800-208