All insights
·Migration & Engineering·IQCDL

Post-Quantum Code Signing: LMS, XMSS, ML-DSA or SLH-DSA for Firmware?

How to choose between LMS, XMSS, ML-DSA and SLH-DSA for firmware and code signing, with CNSA 2.0 timelines and a worked example.


Post-Quantum Code Signing: LMS, XMSS, ML-DSA or SLH-DSA for Firmware?

Most post-quantum discussion focuses on key exchange, because harvest-now-decrypt-later attacks make confidentiality the most urgent problem. Code signing is a different problem with a different clock. A forged signature has no value to an attacker until a cryptographically relevant quantum computer exists, but the verifiers that check those signatures may be burned into silicon and stay in service for fifteen years or more. If you ship devices today with an RSA or ECDSA root of trust, you are deciding now what will be impossible to change later.

This article compares the four signature options that matter for firmware and software signing, sets out what the standards and the CNSA 2.0 timeline say, and works through a signing-budget example.

Why signing is not the same problem as key exchange

Three properties make signature migration awkward.

  • Immutable verifiers. A boot ROM, a fused public-key hash or a hardware loader cannot be patched in the field. Whatever algorithm it verifies today is the algorithm it will verify for the life of the device.
  • Long validity windows. A signature on a firmware image must remain unforgeable for as long as devices accept that image, which can exceed a decade for industrial, automotive, medical and telecoms equipment.
  • Constrained verification. The verifier often runs in a few kilobytes of ROM, with no dynamic memory and a strict boot-time budget. Signature size and verification cost matter far more than they do on a web server.

NIST IR 8547 already sets the general direction: quantum-vulnerable signatures such as RSA and ECDSA are deprecated after 2030 and disallowed after 2035. Our existing coverage of that document explains the dates. The question here is what you replace them with in a boot chain.

The four candidate schemes

Stateful hash-based signatures: LMS and XMSS

LMS (RFC 8554) and XMSS (RFC 8391), together with their multi-tree variants HSS and XMSS^MT, are approved for use in NIST SP 800-208. Their security rests only on the properties of a hash function, a conservative assumption that has been studied for decades. Public keys are small, signatures are in the low kilobytes, and verification is a series of hash computations that are easy to implement in constrained hardware.

The cost is state. Each signature uses one leaf of a Merkle tree, and a leaf must never be used twice. SP 800-208 therefore expects key generation and signing to take place in a hardware cryptographic module, and it treats state handling as a first-class security requirement.

ML-DSA (FIPS 204)

ML-DSA is the lattice-based, general-purpose signature standard derived from CRYSTALS-Dilithium. It is stateless, so there is no leaf-counting problem, and it performs well. The trade-offs are larger keys and signatures (ML-DSA-65 has a public key of 1,952 bytes and a signature of 3,309 bytes) and a security argument that depends on lattice problems rather than on hash functions alone. Verification needs polynomial arithmetic and more working memory than a hash-tree check, which matters on small boot ROMs.

SLH-DSA (FIPS 205)

SLH-DSA is the stateless hash-based standard derived from SPHINCS+. It keeps the conservative hash-only assumption and removes the state problem, but signatures are large (7,856 bytes for the smallest parameter set, and 17,088 bytes for the fast 128-bit set) and signing is slow. It suits cases where signing is infrequent, state management is unacceptable and the bandwidth for a large signature is available.

Comparison

Property LMS / HSS (SP 800-208) XMSS / XMSS^MT (SP 800-208) ML-DSA (FIPS 204) SLH-DSA (FIPS 205)
Security assumption Hash function Hash function Module lattices Hash function
Stateful Yes Yes No No
Public key size Tens of bytes Tens of bytes 1.3 to 2.6 KB 32 to 64 bytes
Signature size Low kilobytes Low kilobytes 2.4 to 4.6 KB About 7.8 to 49 KB
Verification footprint Small, hash only Small, hash only Moderate, polynomial arithmetic Small, but many hash calls
Main operational risk State reuse State reuse Larger implementation surface Signature size and signing time
Named in CNSA 2.0 for firmware Yes Yes No (general-purpose signatures) No

Sizes are taken from the parameter tables in the cited standards. Check the exact parameter set you intend to use.

What the standards and timelines say

NSA's CNSA 2.0 advisory is the clearest published timeline for software and firmware signing. It names LMS and XMSS for this use case, with the expectation that systems support and prefer them from 2025 and use them exclusively by 2030. ML-DSA-87 is the CNSA 2.0 choice for general-purpose signatures, such as certificates, outside firmware and software signing.

If you do not sell into US national security systems, CNSA 2.0 is not binding on you, but it is a reasonable proxy for where procurement requirements may land. NIST has approved both the stateful hash-based schemes (SP 800-208) and the stateless ones (FIPS 204 and 205), so both families are legitimate. The EU coordinated PQC roadmap and ENISA guidance likewise emphasise starting inventory and planning early for long-lived systems, rather than prescribing one signature algorithm.

Treat the decision as a policy question as much as an engineering one. Record which framework you are aligning to, which schemes are permitted for which asset class, and who can approve an exception.

Worked example: a signing budget for a long-lived device fleet

The numbers below are illustrative, not taken from a real programme.

Scenario. A manufacturer ships industrial controllers with a 15-year service life. It plans to sign production firmware for 10 years after launch. The release pipeline produces 40 signed images per month across product variants. Each production image is preceded by five release-candidate builds that are also signed, so they can be flashed on test rigs.

Step 1: count every signature.

  • Production images: 40 per month x 12 months x 10 years = 4,800
  • Release candidates: 4,800 x 5 = 24,000
  • Total if candidates use the same key: 4,800 + 24,000 = 28,800

Step 2: compare with tree capacity. A single LMS tree of height 15 offers 2^15 = 32,768 one-time keys. A total of 28,800 consumes about 88 percent of that capacity, with no allowance for re-signing after a defect, a rejected audit build or a pipeline fault that burns keys. That is too thin.

Step 3: restructure.

  • Use a separate, lower-assurance key for release candidates so they never draw from the production tree.
  • Production signatures drop to 4,800, which uses about 15 percent of a height-15 tree.
  • Alternatively, use HSS with two levels of height 10, which gives 2^20 = 1,048,576 signatures. This leaves very large headroom, at the price of an extra signature and public key in each image.

Step 4: check the verifier. The boot ROM must support the chosen LMS and LM-OTS parameter sets and, if HSS is used, the multi-level verification path. Image headers must carry a signature of a few kilobytes. If the ROM is already frozen with RSA-2048 or ECDSA P-256, none of this helps existing hardware, and that fleet must be handled through a hardware refresh or a verified second-stage bootloader.

The lesson is that the choice of scheme matters less than discipline in counting signatures, separating keys by assurance level and confirming verifier support before the silicon is fixed.

Engineering pitfalls to design out early

State management

State reuse is the failure that matters most. Common ways it happens include restoring an HSM from a backup taken before a signing session, cloning a virtual signing host, and running two signers against the same key. SP 800-208 expects the private key and its state to be handled inside a validated hardware module and not exported in a form that permits rollback. If you need several signing sites, partition the index space at key generation rather than sharing one key, and test your disaster-recovery procedure against the state requirement.

Root of trust and key hierarchy

Put the long-lived, hard-to-rotate key in the smallest possible role. A common pattern is a root key that only signs intermediate signing keys, with the intermediates used by the build pipeline and rotated on a schedule. A hash-based root with generous capacity suits this role because it signs rarely.

Agility inside the boot chain

Do not hard-code a single algorithm identifier in the image format. Include an algorithm field, define how a verifier treats unknown values, and decide in advance that it fails closed. Where memory allows, dual signing with a classical and a post-quantum scheme lets you migrate without a flag day. It also lengthens boot verification, so measure it on the target hardware. Our cryptographic agility guide covers the wider design principles.

Inventory and ownership

Code-signing keys are easy to miss in a cryptographic inventory because they live in build systems, HSMs and vendor tooling. Add them to your CBOM, record the verifier that consumes each key, and note the device population that depends on it.

Where IQCDL fits

IQCDL helps teams turn a decision like this into repeatable practice. The assessment shows where your engineers and policy owners stand on signature schemes, key management and migration planning. The programmes cover hands-on implementation, including hash-based and lattice-based signature use. The standards page maps our curriculum to FIPS 203, 204 and 205, SP 800-208 and related guidance, so that your internal policy can cite the same sources.

FAQ

Is ML-DSA acceptable for firmware signing?

ML-DSA (FIPS 204) is a NIST-standardised signature scheme and is suitable for many code-signing uses. For firmware and software signing, however, NSA's CNSA 2.0 guidance names the stateful hash-based schemes LMS and XMSS (NIST SP 800-208) as the preferred option. Check which framework your customers or regulators apply before choosing.

Why are LMS and XMSS called stateful?

Each signature consumes a one-time key from a finite set. The signer must record which keys it has used and never reuse one. Reuse can allow an attacker to forge signatures, so the state must be managed inside a controlled hardware module.

Do we need to replace the signature on devices already in the field?

Devices whose boot ROM or fused root of trust only verifies RSA or ECDSA cannot be moved to a new scheme in software without trusting the very algorithm you are replacing. Plan a hardware refresh or a verified secondary boot stage, and treat the fleet as a risk-register item with an end date.

Can we sign firmware with both a classical and a post-quantum algorithm?

Yes. Dual signing lets a device accept an image only if both signatures verify, which hedges against weaknesses in either scheme. It increases image size and verification time, so confirm that the verifier has the memory and boot-time budget before adopting it.