Recursive AI

Post-quantum

All onecrypto docs

OneCrypto carries its own implementations of the NIST post-quantum algorithms, in managed code on top of its own Keccak, so that every platform (Windows, Linux with any OpenSSL, macOS, mobile, the browser) gives the same results and the same tests run everywhere. The primitives never call the platform's ML-KEM, ML-DSA or SLH-DSA; the platform types are used as comparison oracles in the tests, and by the two routes described next.

Going post-quantum

  • Default. Every format and key path uses the library's own implementations on every platform: X.509 (certificates, requests, revocation data), CMS (SignedData, KEMRecipientInfo), PKCS#8, Crypto.Load and the key interfaces (PrivateKey.FromSlhDsa, FromMlKemDecapsulationKey, FromCompositeMlKem, FromHss, FromXmss, FromXmssMt).
  • Presets. CryptoPolicy.Standard keeps classical data readable (a quantum-vulnerable key carries an advisory and changes no verdict) and names hybrid choices for new data: composite ML-DSA-65 with Ed25519 and X25519 with ML-KEM-768 (NewSignatureSuite, NewKemSuite). CryptoPolicy.Cnsa2 is post-quantum only: ML-KEM-1024 and ML-DSA-87, SHA-384 or SHA-512 for signatures, LMS and XMSS accepted; classical and composite keys are rejected for new data and flagged when read. See policy.md.
  • Composite ML-KEM (draft-ietf-lamps-pq-composite-kem, revision 24): ML-KEM-768 with X25519, P-256 or P-384, and ML-KEM-1024 with X448, P-384 or P-521, through CompositeMlKemPrivateKey and CompositeMlKemPublicKey, X.509 keys, PKCS#8 and CmsRecipient.Kem. The RSA-OAEP and Brainpool pairings are not implemented. The draft's published vectors for the implemented pairings all pass (testdata/pq/composite-kem-24.json). The shared secret is SHA3-256(mlkemSS || tradSS || tradCT || tradPK || Label); the X25519 pairing equals the construction known as X-Wing.
  • Hash-based signatures in PKI. HSS/LMS (RFC 9708) and XMSS/XMSS^MT (RFC 9802) are verified in certificates and CMS; signing goes through PrivateKey.FromHss, FromXmss and FromXmssMt, whose state store reserves a leaf before any signature is released. Never restore such a key from a backup.
  • Composite ML-DSA (draft-ietf-lamps-pq-composite-sigs, revision 19): all 18 registered algorithms (ML-DSA-44/65/87 with RSA-PSS, RSA PKCS #1, ECDSA P-256/384/521 and Brainpool, Ed25519 or Ed448), through CompositeMlDsaPrivateKey and CompositeMlDsaPublicKey, X.509, PKCS#8, Crypto.Load, the key interfaces and CMS. The message representative is Prefix || Label || len(ctx) || ctx || PH(M); the ML-DSA half signs with the label as its context. The draft's published vectors (signature with and without context, and private key to public key) pass for all 18 (testdata/pq/composite-sigs-19.json). CryptoPolicy.GenerateSigningKey() makes the key the preset names: composite ML-DSA-65 with Ed25519 under Standard, ML-DSA-87 under Cnsa2.
  • Two-phase ML-DSA. PreparedSignature.PrepareMu computes the FIPS 204 message representative mu (external mu, Algorithm 7) from the public key, the context and the data; the signer signs only the 64 bytes with IMuSigningKey.SignMu (or an HSM's external-mu call), and the result verifies as a plain ML-DSA signature.
  • FIPS mode. CryptoPolicy.FipsMode = true means the library's own post-quantum code is never used: the operation goes to the platform or is refused with AlgorithmNotSupportedException (or the status AlgorithmNotSupported for a verification), naming the algorithm, the platform and FIPS mode. Routed: ML-DSA/SLH-DSA signature checks (PublicKeyInfo.VerifySignature(..., policy, at), CMS verification with SignedDataVerifyOptions.Policy, the path validator through ValidationOptions.Policy), ML-KEM encapsulation (CmsRecipient.Kem(certificate, identifier, policy)), and, for keys the library holds, key generation, signing and decapsulation through the policy overloads of PrivateKey (FromMlDsaPrivateKey, FromSlhDsa, FromMlKemDecapsulationKey, GenerateMlDsa, GenerateSlhDsa, GenerateMlKem) and CmsDecryptionKey.FromMlKemDecapsulationKey. Refused: composite ML-DSA and ML-KEM, LMS/HSS, XMSS/XMSS^MT, and OpenPGP's post-quantum keys. A key wrapped without the policy overload keeps using the library's code.
  • Keys in the OS, a TPM or an HSM use their own backend: PrivateKey.FromMLKem(MLKem) and FromMLDsa(MLDsa) wrap the platform's key objects, and .Keys PKCS#11 keys sign and decrypt in the token.

ML-KEM (FIPS 203)

RecursiveAI.OneCrypto.Primitives.MlKemFips203 (span one-shots), MlKemEncapsulationKey and MlKemDecapsulationKey (key objects), MlKemSet (the parameter set). The names differ from the platform's MLKem and MLKemAlgorithm so both can be imported together.

What is implemented

All of FIPS 203's algorithms for ML-KEM-512, ML-KEM-768 and ML-KEM-1024:

SectionAlgorithmWhere
4.2.1Compress, Decompress, ByteEncode, ByteDecodeMlKemCore
4.3NTT, inverse NTT, base-case multiplicationMlKemCore
4.2.2SampleNTT (rejection sampling from SHAKE128), SamplePolyCBDMlKemCore
5K-PKE key generation, encryption, decryptionMlKemCore
6.1 to 6.3KeyGen_internal (from the seed d and z), Encaps_internal (with a supplied message m), Decaps_internalMlKemFips203.TryDeriveKeyPair, TryEncapsulateDerandomized, TryDecapsulate
7.1 to 7.3KeyGen with random d and z, Encaps with random m, DecapsTryGenerateKeyPair, TryEncapsulate, and the key objects
SetEncapsulation keyExpanded decapsulation keyCiphertextShared secret
ML-KEM-512800163276832
ML-KEM-76811842400108832
ML-KEM-102415683168156832

Key forms and input checks

  • The canonical private key is the 64-byte seed d || z (MlKemDecapsulationKey.FromSeed, Generate, ExportSeed). The expanded key (dkPKE || ek || H(ek) || z) is accepted as well (FromExpanded, ExportExpanded); a key imported that way has no seed (HasSeed is false).
  • Section 7.2: an encapsulation key is checked for length and for the modulus check (every 12-bit coefficient below q = 3329) before it is used. TryEncapsulate returns false and MlKemEncapsulationKey.FromBytes throws when it fails.
  • Section 7.3: an expanded decapsulation key is checked for length and for H(ek) equal to the stored hash. The embedded key is not modulus-checked by the span API, because the section does not ask for it (the reference vectors include keys whose embedded key was altered and expect a result); MlKemDecapsulationKey.FromExpanded does refuse an embedded key that fails the modulus check, since that key could not encapsulate. The ciphertext is checked for length only; any ciphertext of the right length decapsulates.
  • Decapsulation never reports a forged ciphertext: it returns the implicit-rejection secret J(z || c), as section 6.3 says.
  • Wrong lengths return false from Try... methods and raise ArgumentException from the key factories; an undefined MlKemSet raises ArgumentOutOfRangeException. Nothing is written to a destination when a check fails.

Secret handling

  • Seeds and expanded keys held by MlKemDecapsulationKey sit in pinned memory and are zeroed on Dispose. Working buffers on the stack that held secrets are zeroed before return.
  • The private-key paths have no secret-dependent branch or index. Reductions modulo q are a multiply and a shift followed by a mask, never % or / on a value that depends on a secret, so the divider-latency leaks of the "KyberSlash" kind cannot arise. In particular Compress does not divide: with the numerator n = (x << d) + 1664, floor(n / q) is computed as (n * 20642679) >> 36, which equals integer division for every n up to 22,157,056; a test checks all of that range, and every Compress and Decompress input for every d the standard uses, against real division. Selection between the accepted secret and the implicit-rejection secret is a byte mask over a full comparison of the ciphertext with its re-encryption.
  • The one data-dependent loop is the rejection sampling of the public matrix from the public seed rho (Algorithm 7). Its duration depends on rho, which is part of the encapsulation key, so the run time of key generation and of decapsulation depends on the key's public part, as it does in every implementation of the algorithm.
  • The compiled form of Decaps was read for conditional jumps on data: the only ones are length checks and loop counters.

Keccak

All hashing inside ML-KEM (SHA3-256, SHA3-512, SHAKE128, SHAKE256) uses the library's own Keccak (Primitives/Fallback) on every platform. KeccakXof is an incremental sponge (absorb in pieces, squeeze repeatedly). Keccak4 runs four independent permutations at once: with AVX2 on 256-bit vectors; on arm64 with AdvSimd as two passes of a two-way (128-bit) permutation; otherwise one after the other on the scalar permutation, with identical results; ML-KEM uses it to sample the matrix four entries at a time. The scalar permutation does two rounds per loop pass (state a to e and back) and finishes chi one row at a time, which keeps fewer lanes live and spills fewer registers; squeezing copies whole lanes with one block copy on little-endian machines. The two-way arm64 permutation runs a four-state call in about 205 ns per state against about 250 ns for one scalar permutation, but on ML-KEM it moves no row outside the noise (matrix sampling is a small part of the call), so the scalar and the vector paths are both kept and tested against each other.

Vectors and checks

  • NIST ACVP: ML-KEM-keyGen-FIPS203, ML-KEM-encapDecap-FIPS203 and its -tr1 revision (decapsulation from seed and from expanded keys, encapsulation, encapsulation-key and decapsulation-key checks).
  • Wycheproof: mlkem_{512,768,1024}_{test,encaps_test,keygen_seed_test,semi_expanded_decaps_test}.json.
  • C2SP CCTV ML-KEM/: intermediate values, the modulus vectors (every invalid encapsulation key is rejected), the strcmp and unlucky-sampling vectors, and the accumulated runs (10,000 tests per set in the normal suite; one million per set with ONECRYPTO_LONG=1). The intermediate, unlucky-sampling and accumulated files of the pinned CCTV commit were generated with the draft standard's key generation, which hashes d without the parameter byte k; the tests reproduce that single difference through an internal switch and everything else is the final standard. The ACVP vectors and Wycheproof's key generation file use the final standard and pass with k appended.
  • Differential: openssl 3.5 (pkey, pkeyutl -encap/-decap; keys derived from the same seed are identical, and each side decapsulates what the other encapsulates) and the platform's MLKem where the machine has it.
  • tools/fetch-pq-vectors.sh fetches the ACVP and CCTV files at pinned commits into $ONECRYPTO_VECTORS (default ~/onecrypto/vectors); nothing from them is committed.
  • Timing: timing.md and the claim in conformance.md.

Stateful hash-based signatures: LMS, HSS, XMSS, XMSS^MT

OneCrypto implements the two stateful hash-based signature families approved for firmware and software signing by NIST SP 800-208 and named in CNSA 2.0, in managed code on every platform (SHA-256 and SHA-512 from the platform, SHAKE from the library's own Keccak). The code is in RecursiveAI.OneCrypto.Primitives; X.509 and CMS wiring sits above it.

What is implemented

SchemeSpecificationParameter sets
LM-OTS, LMSRFC 8554 sections 4 and 5RFC 8554: SHA-256 with n = 32, w = 1, 2, 4, 8, h = 5, 10, 15, 20, 25. NIST SP 800-208 section 4: SHA-256/192 (n = 24), SHAKE256/256 (n = 32), SHAKE256/192 (n = 24), same w and h. Type codes 1 to 16 (LM-OTS) and 5 to 24 (LMS).
HSSRFC 8554 section 6one to eight LMS levels; verification takes any mix of registered sets, signing requires one hash and node size across the levels and heights adding up to at most 63
WOTS+, XMSSRFC 8391 sections 3 and 4.1SP 800-208 sets: SHA2-256 (Sha2H{10,16,20}N256), SHA2-192, SHAKE256/256, SHAKE256/192. The RFC 8391 sets with SHA-512, SHAKE128 and SHAKE256 with 512-bit output are also implemented (SP 800-208 does not approve them). Codes 1 to 21.
XMSS^MTRFC 8391 section 4.2the 8 (h, d) shapes of each hash family, codes 1 to 56

Verification works everywhere, for every set, on public data (variable time). Key generation and signing work for every set; the time they take grows with 2^h (XMSS) or 2^(h/d) (XMSS^MT) leaf computations, so a key with a 20-level tree takes minutes to hours to create.

Public types: Lms, Hss, Xmss, XmssMt (sizes and Verify), LmsPrivateKey, HssPrivateKey, XmssPrivateKey, XmssMtPrivateKey (generate, from seed, sign, remaining count, export and import), and the state types below. The names do not collide with the platform's MLDsa/SlhDsa types.

Key forms

  • LMS/HSS public key is the RFC 8554 encoding: for HSS the level count followed by the root tree's lms type || LM-OTS type || I || T[1]; LmsPrivateKey.PublicKey is the same without the level count. Signatures are RFC 8554 sections 5.4 and 6.2 byte for byte.
  • XMSS and XMSS^MT public key is OID || root || SEED (RFC 8391 sections 4.1.7 and 4.2.2), the signature idx || r || ... with a 4-byte index for XMSS and ceil(h / 8) bytes for XMSS^MT.
  • Private keys hold a seed (LMS: SEED and I, XMSS: S_XMSS, SK_PRF and SEED) in a pinned buffer that is zeroed on dispose. Every WOTS+ and LM-OTS secret element derives from the seed and its position (RFC 8554 appendix A and SP 800-208 algorithm 10', which gives PRFkeygen(S_XMSS, SEED || ADRS)), and the seeds and identifiers of the lower trees of an HSS key derive from the master seed and the tree's position. The only changing state is therefore the leaf counter.
  • Export writes version, parameter sets, seeds, the counter, the public key and an 8-byte check value; Import verifies the check value, and the first signature rebuilds the root tree and fails if its root is not the stored public key. The bytes are secret. Importing moves the store's counter forward to the exported value and never back.

State: a leaf is never used twice

NIST SP 800-208 section 8.1 requires the incremented leaf index to be stored in nonvolatile storage before a signature is exported, and section 9.1 explains why a plain buffered file write is not enough. ISignatureStateStore is that contract:

  • Reserve(capacity, requested, out first) durably reserves up to requested leaves and returns how many it reserved (0 = exhausted). A key calls it before it computes anything with a leaf. A crash after the reservation loses leaves and never repeats one.
  • InMemorySignatureStateStore is for tests and process-lifetime keys. FileSignatureStateStore keeps two checksummed 32-byte records (sequence, counter, capacity); a reservation overwrites the older record and flushes to the device before returning, so a write torn by a crash can damage only the record being written. The file is opened exclusively for every operation, so threads, key objects and processes sharing it never receive the same leaf. If neither record is valid the store reports SignatureStateException; it never restarts at zero. A store records the key's capacity and refuses another.
  • reservationSize greater than 1 reserves a batch (fewer writes, up to batch - 1 leaves lost per crash).
  • RemainingSignatures is capacity minus the durable counter plus unused reserved leaves. At zero, signing throws SignatureStateExhaustedException and signs nothing.
  • The signature on the root of each lower HSS or XMSS^MT tree is deterministic (the RFC 8554 appendix A randomiser; XMSS has no randomiser there), so it is made once and kept; after a restart it is made again with the same bytes (SP 800-208 section 8.1, footnote 9, asks that it be made once, which a key held in one process does).

Limits of the guarantee: it is as strong as the file system's honouring of a flush; the directory entry of a new state file is not flushed separately (create it before the key is used); copying a state file or restoring a backup, or a store on a file system without exclusive-open semantics, voids it. Exporting a private key is what SP 800-208 forbids for a validated module; Export exists for applications that own that risk.

Verification semantics

Lengths, type codes and the leaf index are checked before any hashing, and every failure is a false, never an exception. An LM-OTS set must match its tree's hash and node size (SP 800-208 section 4). HSS requires the signature's level count to equal the public key's and checks each tree's signature on the next tree's public key. XMSS rejects an index at or above 2^h.

Constant time

The secrets are the seeds. They only feed hash inputs; no branch, loop bound or index depends on them. Chain lengths come from the message digest (public), and verification handles public data only. Timing evidence: see timing.md, "Stateful hash-based signatures". The claim is limited to the targets listed there (LM-OTS signing and key generation, WOTS+ signing and key generation, LMS key generation from a seed); it does not cover the platform's SHA-2 or the library's Keccak beyond what those targets exercise.

Interoperability

LMS/HSS and XMSS agree with Botan 3.10.0 in both directions for every set Botan offers (see conformance.md); the SHA-256/192 LMS sets and all XMSS^MT sets have no second implementation available and stand on the ACVP vectors and on code shared with the verified paths.

XMSS^MT has no external oracle: Botan 3.10.0 offers XMSS and HSS/LMS only, so the XMSS^MT parameter sets are tested against themselves (sign, verify, tamper and mutation runs) and share the WOTS+, L-tree and single-tree code that Botan does verify. OpenSSL 3.5.9 and 3.6.2 offer no LMS (and no XMSS), so they are not oracles for any set in this section; the OpenSSL two-way runs elsewhere in this document cover the lattice and hash-based algorithms OpenSSL has.

Speed

The per-call cost of the platform's SHA-256 is the floor for the SHA-256 sets: every chain step is one call on a 55-byte input. On a Ryzen 9 7950X3D (Linux, .NET 10.0.15) one SHA256.HashData call takes about 385 ns whatever the input size up to two blocks; on an Apple M2 (.NET 10.0.14) 110 to 140 ns on a 32 to 119 byte input. LMS key generation with SHA-256, n=32, h=5, w=8 makes about 278,600 such calls, so the 108.7 ms it takes on x64 is within about 1.5% of the calls alone, and the code around them is not where the time goes.

SLH-DSA (FIPS 205)

RecursiveAI.OneCrypto.Primitives: SlhDsaScheme (static span one-shots), SlhDsaPrivateKey, SlhDsaPublicKey, SlhDsaVariant (the twelve parameter sets) and SlhDsaPreHash (the HashSLH-DSA functions). The names avoid the platform's SlhDsa and SlhDsaAlgorithm, and the parameter-set types of other libraries, so imports can sit side by side.

What is implemented

  • All twelve parameter sets of FIPS 205 Table 2: SLH-DSA-SHA2 and SLH-DSA-SHAKE at 128, 192 and 256 bits, each in the small ("s") and fast ("f") form. Sizes follow the table: public key 2n bytes (32, 48, 64), private key 4n (64, 96, 128), signatures from 7,856 bytes (128s) to 49,856 (256f).
  • The building blocks of sections 4 to 8: the address structure (ADRS, and the 22-byte compressed form the SHA-2 sets use), WOTS+, the XMSS tree, the hypertree and FORS, written as the standard describes them; the internal algorithms of section 9 (key generation from three seeds, sign, verify) and the external interface of section 10: pure signing and verification with a context string, and HashSLH-DSA.
  • SHA-2 sets (section 11.2): the platform's SHA-256, SHA-512 and HMAC. The category 1 sets (n = 16) use SHA-256 everywhere; the category 3 and 5 sets use SHA-256 for F and PRF and SHA-512 for H, T_l, PRF_msg (HMAC) and H_msg (MGF1). The platform has no way to resume a hash from a stored state, so each tweakable hash hashes the 64 or 128-byte padded seed block again.
  • SHAKE sets (section 11.1): SHAKE256 from OneCrypto's own Keccak.
  • Signing is hedged by default: each signature takes n fresh bytes from RandomNumberGenerator. deterministic: true uses PK.seed instead, which section 10.2.1 allows; SlhDsaScheme.TrySignWithRandomizer takes the n bytes from the caller for reproducible tests. Verification does not care which was used.
  • Context of 0 to 255 bytes, bound into the signed message. A longer context raises ArgumentException when signing and fails verification.
  • HashSLH-DSA with SHA-256, SHA-384, SHA-512, SHA3-224/256/384/512, SHAKE128 (256-bit output) and SHAKE256 (512-bit output), each bound to its OID so that the pure form and each pre-hash form are separate signature domains. SHA-224, SHA-512/224 and SHA-512/256 are also accepted, through TrySignHash and VerifyHash with a digest the caller computed: the platform has none of the three and OneCrypto does not ship a second SHA-2. The message forms for those three raise AlgorithmNotSupportedException.

Key forms

FormContentAPI
seedsSK.seed ‖ SK.prf ‖ PK.seed (3n bytes)SlhDsaPrivateKey.FromSeed, ExportSeed
private keySK.seed ‖ SK.prf ‖ PK.seed ‖ PK.root (4n bytes)FromPrivateKey, ExportPrivateKey
public keyPK.seed ‖ PK.root (2n bytes)SlhDsaPublicKey.FromBytes, Export, ToArray

FromSeed computes PK.root, which is one top-layer tree (about 1 to 7 ms for the "f" sets, 100 to 170 ms for the "s" sets on a desktop x64 core). FromPrivateKey recomputes it and refuses a key whose stored PK.root does not match its seeds (CryptographicException). Secret bytes live in a pinned buffer zeroed on Dispose; a garbage-collected runtime cannot promise that no other copy exists.

Limits and failure behaviour

  • Wrong key, seed or digest lengths raise ArgumentException on the signing side; verification returns false for a wrong public key length, signature length or digest length.
  • Signing returns false, writing nothing, when the destination is shorter than the signature.
  • The span path allocates nothing, except that a message over 1 KiB is concatenated into a pooled array for the two SHA-2 message hashes (once per signature or verification).
  • Verification is a bool at this layer; reports belong to the layers above.

Timing claim

See conformance.md for the numbers. By design there is no secret-dependent branch, loop bound or array index: SK.seed and SK.prf only ever enter hash inputs, and which hashes run depends on the public message digest. The tree a signature uses is chosen by H_msg over R = PRF_msg(SK.prf, …), so it depends on SK.prf through a hash output that the signature publishes; the targets measure SK.seed and SK.prf separately for that reason. The platform's SHA-2 and HMAC are inside the measured calls.

Tests

ACVP key generation, signature generation (both interfaces, hedged and deterministic, pure and pre-hash) and signature verification for every set; signatures exchanged both ways with OpenSSL 3.5 and with the platform's SLH-DSA where the machine has it. The vectors are fetched by tools/fetch-acvp-slhdsa.sh.

ML-DSA (FIPS 204)

What is implemented

PartSpecNotes
ML-DSA-44, -65, -87FIPS 204 Table 1public key 1312 / 1952 / 2592 bytes, expanded signing key 2560 / 4032 / 4896, signature 2420 / 3309 / 4627
KeyGen from the 32-byte seedAlgorithm 1 and 6the seed is the canonical private key
Sign, hedged (default) and deterministicAlgorithm 2 and 7deterministic is the all-zero 32 bytes of randomness (MlDsaScheme.DeterministicRandomness)
VerifyAlgorithm 3 and 8
Context stringsection 5.20 to 255 bytes, empty by default
HashML-DSAAlgorithm 4 and 5SHA-256/384/512, SHA3-224/256/384/512, SHAKE128 (32-byte output), SHAKE256 (64-byte output) computed by the library; SHA-224, SHA-512/224 and SHA-512/256 through the digest overloads (nothing in the platform offers those hashes)
External musection 6ComputeMu, TrySignMu, VerifyMu; for two-phase signing and HSM flows
Internal interfaceAlgorithm 6, 7, 8internal to the assembly; used by the ACVP runner

API: MlDsaScheme (size constants and span one-shots over the expanded key), MlDsaPrivateKey (pinned buffer, zeroed on Dispose), MlDsaPublicKey (immutable). The names are chosen not to collide with the platform's MLDsa and MLDsaAlgorithm. TrySign* returns false for a short destination, throws ArgumentException for a wrong length or a context over 255 bytes and CryptographicException if no attempt succeeds within 1000 attempts (probability far below 2^-100). Verify* returns false for every malformed input.

Key forms

A key made from a seed (FromSeed, Generate) exports both the seed and the expanded key. FromExpanded imports the expanded form and checks it: every stored secret coefficient is in [-eta, eta], t = A s1 + s2 splits into the stored t0, and the stored tr is the hash of the public key those values give. A key imported this way has no seed (HasSeed is false). The static MlDsaScheme.TrySign uses an expanded key as given, without the check.

Verification

Verification refuses: a wrong key or signature length, a context over 255 bytes, a z with infinity norm not below gamma1 - beta, and a hint encoding that is not canonical (a row end below the previous one or above omega, positions not strictly increasing within a row, a non-zero unused slot), then compares the commitment hash. It uses only public data and makes no timing claim.

Timing

No secret-dependent branch or table index in key generation or in one signing attempt: secrets meet integer arithmetic, masks and fixed-length loops (Montgomery multiplication, NTT, Decompose and MakeHint by multiplication and masks, norm checks accumulated into one flag). Two things depend on data by design and are not claimed:

  • the number of signing attempts (Fiat-Shamir with aborts; FIPS 204 accepts that it reveals only discarded candidates), and
  • the number of half-bytes read when sampling s1 and s2 from the seed (rejection sampling, Algorithm 31).

Every attempt computes all of its checks whatever the outcome, so its work does not depend on whether it will be accepted. The timing targets (ML-DSA-xx/keygen-seed, ML-DSA-xx/sign-attempt-key, each with an A/A control) hold both counts equal between the two classes: the random class draws seeds that read as many half-bytes as the fixed seed, and the signing target runs exactly one attempt. Results: timing.md.

Tests

NIST ACVP (key generation, signature generation in both revisions, signature verification: every group of pure, pre-hash, internal and external-mu, deterministic and hedged), Wycheproof (mldsa_{44,65,87}_{verify,sign_seed,sign_noseed}_test), the C2SP accumulated tests (100 and 10,000 iterations) and the exhaustive field-operation digest, a check of Decompose and UseHint against the standard's formulas for every residue, and two-way runs with OpenSSL 3.5 and the platform's own ML-DSA. Counts: conformance.md.