docs: QA S-04, S-07, S-08, S-12 as gaps; the expanded key is 35 kB on the stack

- The expanded ML-DSA-65 key is 34,992 bytes on the stack (QA measured;
  A_hat's rows are boxed inside ml-dsa), not 64 kB, and it is exactly the
  secret part. src/sign.rs and docs/02_signatures.md corrected.
- S-04: ml-dsa's signing loop leaves rnd, rho'' and y on the stack; a
  leaked y gives s1. Recorded in docs/02 and docs/THREAT_MODEL.md, with the
  key-construction stack copy.
- S-07: under open question 1, the recommendation for Day 3: a separate,
  freshly generated composite identity, never a wrapped Tessera Ed25519
  seed (RFC 10073 3.1); from_bytes cannot detect reuse (also on its docs).
- S-08: verify_binding does not tie id to vk and has no serial; both are
  the caller's, with the Day 3 replay rule (QA E-07); also on its docs.
- S-12: decoded on 2026-11-26, none of the 9 ML-DSA-65 "modified z" sigVer
  cases at a7f283cd reaches the z infinity-norm bound (max 524,077 <
  524,092), so no ACVP case could be added; only Wycheproof covers it.
- S-05, S-10, S-11 noted under "As built" and gaps.
This commit is contained in:
2026-11-26 03:49:56 +01:00
parent 9f9318664f
commit 0b2480bf83
3 changed files with 54 additions and 4 deletions
+15 -1
View File
@@ -295,7 +295,8 @@ impl fmt::Debug for Signature {
/// blocking-pool or JNI threads that sign at least 512 KiB, and measure unoptimised debug builds.
pub struct SigningKey {
seeds: Zeroizing<[u8; SIGNING_KEY_LEN]>,
// Boxed: the expanded ML-DSA-65 key is about 64 kB.
// Boxed: the expanded ML-DSA-65 key is 34,992 bytes on the stack (its A_hat rows are already
// boxed inside ml-dsa); those bytes are the secret part, s1, s2, t0 and their NTT forms.
ml: Box<ExpandedSigningKey<MlDsa65>>,
ed: ed25519_dalek::SigningKey,
public: VerifyingKey,
@@ -315,6 +316,12 @@ impl SigningKey {
/// Parse a stored signing key: the ML-DSA-65 seed, then the Ed25519 seed (RFC 10073's
/// private key format).
///
/// **The 64 bytes must come from [`SigningKey::generate`]** (or from another RFC 10073 composite
/// key), never from component seeds used anywhere else: RFC 10073 §3.1 forbids reusing a
/// component key, and an existing Ed25519 seed (Tessera's, say) wrapped in here would make
/// every classic signer of that key a potential forgery oracle for the composite if ML-DSA
/// ever falls (QA S-07). This function cannot tell: any 64 bytes are a valid key.
///
/// # Errors
/// [`Error::InvalidLength`] if it is not 64 bytes. Every 64-byte value is a valid key.
pub fn from_bytes(bytes: &[u8]) -> Result<Self, Error> {
@@ -424,6 +431,13 @@ pub fn bind_kem_key<R: CryptoRng + ?Sized>(
/// Check a key binding made by [`bind_kem_key`], at time `now` (Arcanum has no clock).
///
/// **Two checks stay with the caller** (QA S-08): (1) that `vk` is *the* verifying key of `id`,
/// from a trusted source: a binding only says "the holder of `vk` says `kem` is `id`'s"; and
/// (2) freshness: there is no serial, so after a rotation the previous binding still verifies
/// until its `valid.1`. Keep windows short and keep only the binding with the newest `valid.0`
/// per `id`, refusing older ones (Day 3's replay design, QA E-07). `(0, u64::MAX)` is an
/// eternal binding; avoid it.
///
/// # Errors
/// In this order: [`Error::InvalidValidity`] or [`Error::TooLong`] for a malformed window or id;
/// [`Error::InvalidSignature`] if the binding is not authentic; [`Error::OutsideValidity`] if it is