Commit Graph

3 Commits

Author SHA1 Message Date
mnovak 002371445b test: the zeroize probe also watches the expanded ML-DSA key (QA S-04)
The probe looked only for its 32-byte canary, i.e. the seeds; the key
material that actually signs is derived from them and never contains it,
so an unwiped copy of the expanded key went unseen (QA's mutation Q15).

The probe allocator now also watches up to four further 32-byte patterns,
held in atomics (dealloc must not allocate or lock). The test computes the
canary key's FIPS 204 expanded encoding with ml-dsa itself and watches K
(held raw inside ml-dsa's ExpandedSigningKey) and a 32-byte window of the
encoded s1; controls show an unwiped copy is seen and a Zeroizing one is
not; then building, signing, binding and dropping a canary SigningKey must
free no block holding either.

Q15 re-checked: a SigningKey field holding an unwiped Vec of
ml.to_expanded() fails the probe at the new assertion (reverted). The
ml-dsa rnd / rho'' / y stack residue is out of the probe's reach (stack,
not heap) and is recorded as a gap.
2026-11-26 03:48:11 +01:00
mnovak 2a432f5d86 test: the v0.2.0 signature tests, written before the code
The mandatory tests of docs/02_signatures.md, against the API the doc sets
out (arcanum::sign). They do not compile yet: the module does not exist.

1 kat_mldsa65: ACVP keyGen, sigGen (deterministic and hedged groups, byte
  for byte, through sign_randomized/sign_mu_randomized fed the vector's
  rnd), sigVer on the corrected file; Wycheproof sign_seed and verify.
2 kat_ed25519: RFC 8032 section 7.1 and Wycheproof, with verify_strict.
3 sig_composite: the RFC 10073 vectors s and sWithContext verify, the RFC
  key derives the RFC public key, own signatures verify under an
  independent rebuild of M', ML-DSA hedged with ctx = Label.
4 sig_halves: either half swapped in from another signature, zeroed or
  cut, or the halves swapped, is refused; the ML-DSA half fails an
  empty-ctx verifier. Not SUF-CMA (RFC 10073 9.2) is pinned.
5 sig_every_byte: any flipped byte of message, ctx, public key or
  signature fails; contexts are prefix-free; key bindings and app
  messages never verify as each other; every binding field matters.
6 sig_malformed: wrong lengths, weak and non-canonical Ed25519 keys,
  0- and 256-byte contexts, a 65536-byte key id, random bytes.
7 sig_hygiene and feature_hygiene: compile-fail checks against a
  default-features consumer (hazmat raw interface, ml-dsa internals,
  non-crypto RNG, Clone), ZeroizeOnDrop, Debug; ml-dsa and ed25519-dalek
  in the normal graph with zeroize and without hazmat or defaults. The
  allocator probe covers the signing keys.
8 golden_v1.rs is untouched.

Adds ml-dsa =0.1.2 (alloc, rand_core, zeroize) and ed25519-dalek =3.0.0
(zeroize) with default features off, base64 for the tests, and bumps the
version to 0.2.0. The fuzz target follows with the code.
2026-11-25 12:48:39 +01:00
mnovak f3e17f3d5c test(qa): A-29 allocator probe, secrets wiped before their heap memory is freed
A separate, unpublished crate with its own workspace (like fuzz/), because a
GlobalAlloc needs unsafe and arcanum keeps forbid(unsafe_code). dealloc scans
each freed block for a 32-byte canary. Controls prove it sees an unwiped Vec
and the reallocation case; checked by adding a reserve(1) after decryption in
open(), which it catches. Heap only: stack copies are out of its reach.
2026-11-25 08:16:44 +01:00