Files
arcanum/HANDOVER.md
T
mnovak 1e7e0bb16c docs: HANDOVER for the v0.2.0 QA round (S-01 to S-12)
What was fixed and how each of QA's mutations now fails, what is recorded
as a gap, the counts at 0b2480b (126 passed / 5 ignored in debug, 127 / 4
in release, clippy and fmt clean, the probe, cargo deny) and a 601 s fuzz
run with no crash, and the consumer advice added (legacy_compatibility
ban, const contexts, 512 KiB signing threads, the binding checks left to
the caller).
2026-11-26 04:03:13 +01:00

190 lines
14 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Handover — Arcanum
Newest entry first. Where this file and the code disagree, the code wins and the next entry says so.
## 2026-11-26 — v0.2.0, QA review answered (builder), still on `feature/signatures`, not merged, not tagged
QA's review (`Via/qa/review-arcanum-pr2.md`, head `d56ee10`): no blocker, no major, 12 minors (S-01 to
S-12). Answered in `99db18a..` this entry; QA's proof tests (`qa_sig_review.rs`) ported where they pin
something, into the existing test files.
**Fixed:**
- S-01, S-02, S-03: tests pin `verify_strict` (a small-order R in the Ed25519 half is refused), the order
of checks in `verify_binding` (a forged window outside `now` is `InvalidSignature`, never
`OutsideValidity`) and two independent seeds in `generate` (exactly 64 bytes drawn, in order). QA's
mutations now fail: Q1 `verify_strict` → `verify` fails `a_small_order_r_in_the_ed25519_half_is_refused`;
Q3 `now` checked first fails `a_forged_window_that_excludes_now_is_invalid_signature_not_outside_validity`;
Q4 the Ed25519 seed copied from the ML-DSA seed fails `generate_draws_two_independent_seeds`.
- S-05: an ML-DSA-65 key with t1 = 0 is refused as `InvalidVerifyingKey`; removing the check fails
`an_ml_dsa_key_with_zero_t1_is_refused`.
- S-09: `AppContext::new` is a `const fn` taking `&'static [u8]`, the only constructor; a consumer passing a
runtime `Vec` does not compile (`sig_hygiene`, E0597/E0716). **API change** from `d56ee10`.
- S-10: `deny.toml` bans `legacy_compatibility` on `ed25519-dalek` and `curve25519-dalek`, and
`ed25519-dalek/hazmat`; enabling either in `Cargo.toml` fails `cargo deny --offline check bans` (checked,
reverted).
- S-06: the docs no longer claim timing hides which half failed; it does not, harmlessly (public data only).
`&` became `&&`; no behaviour change.
- S-04: the zeroize probe also watches the canary key's expanded ML-DSA K and a window of encoded s1; QA's
Q15 (an unwiped `to_expanded()` copy in `SigningKey`) now fails the probe.
- S-11: stack need documented on `SigningKey`, measured with `tests/sig_stack.rs`: release overflows at
128 KiB and fits in 256 KiB; Arcanum's debug profile overflows at 256 KiB and fits in 512 KiB. A thread
that is too small aborts the process. **Consumers that sign on small threads (worker pools, async
blocking pools, JNI): give them at least 512 KiB.** The release figure is pinned by a test (ignored in
debug).
- The expanded key moves about 35 kB (34,992 B) through the stack when a key is built, not 64 kB.
**Recorded as gaps** (docs/02_signatures.md, and THREAT_MODEL for S-04): S-04's `rnd`/ρ''/y stack residue
inside `ml-dsa`; S-07, the composite is a **separate** identity, never a wrapped Tessera Ed25519 seed
(recommendation under open question 1; `from_bytes` cannot detect reuse); S-08, a binding does not tie
`id` to `vk` and has no serial (Day 3's replay design with QA E-07; also on `verify_binding`'s docs);
S-12, none of the 9 ML-DSA-65 "modified z" sigVer cases at `a7f283cd` reaches the ‖z‖∞ bound (largest
|z| 524,077 < 524,092, decoded by script from the original file), so no ACVP case could be added; only
Wycheproof tests the bound.
**Counts, run by the builder** at `0b2480b` (this entry only adds docs), Windows 10, `cargo 1.99.0`:
| Run | Result |
|:--|:--|
| `cargo test` (debug) | **126 passed, 0 failed, 5 ignored** (the release-only stack test and four stack measurements) |
| `cargo test --release` | **127 passed, 0 failed, 4 ignored** (the four measurements) |
| `cargo clippy --all-targets --all-features -- -D warnings` | clean |
| `cargo fmt --check` (crate, probe, fuzz) | clean |
| `zeroize-probe` (`--test-threads=1`) | 1 passed (now also K and s1 of the expanded key) |
| `cargo deny --offline check` | advisories ok, bans ok, licenses ok, sources ok |
| fuzz `signatures` (rebuilt: `src/` and the target changed) | **601 s, 181,113 executions, 0 crashes, 0 artifacts** (301 exec/s, coverage 3,564), on `0b2480b` |
`cargo audit` was not re-run (no dependency changed except the `curve25519-dalek` dev-dependency,
already in the lock). New since `d56ee10`: 3 tests (S-01 to S-03), 1 (S-05), 1 doctest (the `const`
`AppContext`), `sig_stack.rs` (1 + 4 ignored).
**For consumers, added:** ban `ed25519-dalek/legacy_compatibility` and `curve25519-dalek/legacy_compatibility`
in `deny.toml`, next to `ed25519-dalek/hazmat`; build `AppContext`s as `const`s; check that `vk` is the
right key for `id` before trusting `verify_binding`, and refuse bindings older than the newest per `id`.
## 2026-11-25 — v0.2.0 built (builder), on `feature/signatures` (PR #2), not merged, not tagged
**What it adds:** `arcanum::sign`, hybrid signatures ML-DSA-65 + Ed25519, exactly RFC 10073
`id-MLDSA65-Ed25519-SHA512` (design: `docs/02_signatures.md`, which now has an "As built" section).
Public key 1984 B, signature 3373 B, private key 64 B (ML-DSA seed || Ed25519 seed). The ML-DSA half is
`ExpandedSigningKey::sign_randomized(M', ctx = Label, rng)`, hedged; the Ed25519 half is pure Ed25519 over
M', checked with `verify_strict`; one `InvalidSignature` whichever half fails. `AppContext` (only
`domi/arcanum/v2/sig/app/` + a 1–231-byte label), `bind_kem_key` / `verify_binding` for X-Wing keys under
`domi/arcanum/v2/sig/kem-key`. The bare RFC interface (`sign_composite_raw`, `verify_composite_raw`, any
ctx) is `hazmat` only and still hedged. Stricter than the RFC: a non-canonical or small-order Ed25519 key
is refused at parse. `ml-dsa =0.1.2` (alloc, rand_core, zeroize) and `ed25519-dalek =3.0.0` (zeroize),
default features off. v0.1.0's bytes are unchanged (`tests/golden_v1.rs` untouched, passing).
**Vectors** (`tests/vectors/SOURCES.md`, sha256 of every original and subset): ACVP ML-DSA keyGen (whole)
and sigGen at `2972def2`, sigVer at `a7f283cd`; Wycheproof `ed25519_test` and `mldsa_65_sign_seed` (whole)
and `mldsa_65_verify` (subset) at `20b25694`; the composite-sigs `testvectors.json` at `f0627ab` (the
`id-MLDSA65-Ed25519-SHA512` entry); RFC 8032 §7.1. Subsets made by `tests/vectors/make_subsets.py`.
**Counts, run by the builder** on `feature/signatures`, Windows 10, `cargo 1.99.0` stable MSVC,
`--target-dir D:/cargo-target/arcanum-v2` (intermediates in `D:/cargo-build/`, the machine's `build-dir`):
| Run | Result |
|:--|:--|
| `cargo test` (debug) | **121 passed, 0 failed, 0 ignored** (82 from v0.1.0 + 39 new) |
| `cargo test --release` | **121 passed, 0 failed, 0 ignored** |
| `cargo clippy --all-targets --all-features -- -D warnings` | clean |
| `cargo fmt --check` | clean |
| `zeroize-probe` (`--test-threads=1`) | 1 passed (now also covers the signing key, `to_bytes`, signing and binding) |
| `cargo deny check` | advisories ok, bans ok, licenses ok, sources ok |
| `cargo audit` | 64 crates, 0 vulnerabilities, 0 warnings (advisory db of 2026-11-25, 1,568 advisories) |
| fuzz `signatures` (new) | **605 s, 38,609 executions, 0 crashes, 0 artifacts** (libFuzzer + ASan, nightly `1.102.0` 2026-11-24, MSVC 14.44 asan runtime; coverage 3,549; 63 exec/s; corpus and artifacts on D:), on `5a52854` + the target |
New tests: `kat_mldsa65` 6, `kat_ed25519` 3, `sig_composite` 6, `sig_halves` 5, `sig_every_byte` 7,
`sig_malformed` 5, `sig_hygiene` 6, `feature_hygiene` +1.
**Answers to the doc's open gap:** `verify_strict` accepts both RFC 10073 vectors (`s`, `sWithContext`),
and agrees with all 151 Wycheproof Ed25519 verdicts.
**Mutation checks by the builder** (each reintroduced with `src/sign.rs` edited, seen to fail, reverted;
`git diff` clean after):
- M1, test 4: verify checks only the ML-DSA half (`if ml_ok`): fails `a_zeroed_or_missing_half_is_refused`
and `a_half_from_another_signature_is_refused`.
- M2, test 3/4: the ML-DSA half signs and verifies with an empty ctx instead of Label: fails
`rfc_signatures_verify`, `own_signatures_verify_under_an_independent_rebuild_of_m_prime`,
`ml_dsa_half_uses_the_label_as_its_context` (cargo stopped there; `sig_halves` not reached).
- M3, test 5: ctx left out of M' (its length kept): fails `flipping_any_byte_of_the_context_fails`.
- M4, test 5: `not_after` left out of the binding hash: fails `every_field_of_a_key_binding_matters` and
`a_key_binding_never_verifies_as_an_app_message_and_back` (the documented encoding no longer matches).
- M5, hygiene: `verify_composite_raw` ungated: fails `the_raw_interface_is_not_reachable_without_hazmat`.
- M6, hygiene: `#[derive(Clone)]` on `SigningKey`: fails `ml_dsa_internals_are_not_reachable`.
- M7, test 6: `is_weak()` dropped from the key check: fails `weak_and_non_canonical_ed25519_keys_are_refused`.
**Not verified:** constant time (dudect, Day 7); anything on Linux; interop with a non-Rust RFC 10073
implementation beyond the RFC's own vector (one key, two signatures); a byte-exact composite signing KAT
(the RFC's vectors are hedged; byte-exact checks exist per half); the ACVP and Wycheproof cases dropped by
the subsets; HashML-DSA (not used). The fuzz run is one 10-minute run at 63 exec/s (ASan and ML-DSA are
slow), far fewer executions than v0.1.0's target. The first test commit (`2a432f5`) failed by not compiling
(the module did not exist); it also had one test bug, fixed in `5a52854`. Not audited.
**For consumers:** as for v0.1.0, and also ban a direct `ml-dsa` dependency in `deny.toml` (its
`sign_internal`, `sign_mu_deterministic` and empty-ctx `Signer` are public) and `ed25519-dalek/hazmat`;
never use a composite signature as an identifier (not SUF-CMA, RFC 10073 §9.2, pinned by `sig_halves`).
## 2026-11-25 — v0.1.0 (owner session)
**Who owns this:** the Via owner session. Mark's decisions go through the orchestrator session.
**Released:** `v0.1.0`, an annotated tag on the `--no-ff` merge of PR #1 (`feature/arcanum`, head
`96086be` plus this file) into `main`. **Not audited.** Whether later releases must be signed through
Artifex is an open question for Mark; this tag is not signed.
**What it is:** one `#![no_std]`, `#![forbid(unsafe_code)]` crate, no I/O, no clock, randomness as a
parameter.
- `xwing`: X-Wing (ML-KEM-768 + X25519), draft-connolly-cfrg-xwing-kem-**11**, unmodified (D-QA-1), stricter
in two ways invisible to honest peers: low-order X25519 inputs are `NonContributory`, and a public key whose
X25519 half is not canonical is `InvalidPublicKey` (QA R2-02).
- **The raw one-way KEM is `hazmat` only** (QA R2-01): a release consumer can parse keys and ciphertexts and
generate a key pair, but cannot encapsulate, decapsulate or read an X-Wing secret.
- `exchange`: the mutual exchange (QA A-15), the full transcript bound in Arcanum's HKDF-SHA-256 layer
under `domi/arcanum/v1/...` labels, `Session::wireguard_psk(epoch)`; `RECOMMENDED_EPOCH_SECONDS = 120`.
- `seal`: a one-shot sealed box, 1137 bytes of overhead, no sender authentication, not HPKE.
- `expand` takes exactly one label and one fixed-width field (QA R2-03); the v1 bytes are unchanged
(`tests/golden_v1.rs`).
- Every function that takes an RNG says it must be the OS RNG or a CSPRNG seeded once from it (QA R2-04).
- Licence: CustosPublic's CPAL-1.0 text byte for byte, Exhibit A naming Arcanum, Exhibit B "Built on Domi".
**Counts, run by the owner session** on a fresh clone at `96086be`, Windows 10, `cargo 1.99.0` stable MSVC:
| Run | Result |
|:--|:--|
| `cargo test` (debug) | **82 passed, 0 failed, 0 ignored** |
| `cargo test --release` | **82 passed, 0 failed, 0 ignored** |
| `cargo clippy --all-targets --all-features -- -D warnings` | clean |
| `cargo fmt --check` | clean |
| `zeroize-probe` (`--test-threads=1`) | 1 passed |
| `cargo deny check` | advisories ok, bans ok, licenses ok, sources ok |
| `cargo audit` | 55 crates, 0 vulnerabilities |
| fuzz `untrusted_input` | **631 s, 172,694 executions, 0 crashes, 0 artifacts** (libFuzzer + ASan, nightly `1.102.0`, Windows MSVC; coverage 1,812 edges), on `96086be` |
**Mutation checks by the owner session** (each reintroduced, seen to fail, reverted):
- R2-02: skipping the canonical check fails `qa_r2_02_non_canonical_x25519_public_key_is_refused`.
- R2-01: making `encapsulate` and `SharedSecret::as_bytes` public again fails
`qa_r2_01_raw_shared_secret_is_not_reachable_without_hazmat`. Ungating `as_bytes` alone does not fail
it, correctly: no release function produces a `SharedSecret` then. The test reaches the secret only
through `encapsulate`, not `decapsulate` (a minor gap).
**For consumers (via, via-core, Canalis, Custos, Tabellarius):** depend by git tag, never by path; never
enable `arcanum/hazmat` outside tests, and repeat `tests/feature_hygiene.rs`'s `cargo tree` check in CI; ban a
direct `ml-kem` dependency in `deny.toml` (its `encapsulate_deterministic` is public); pass the OS RNG and
grep for `from_seed(` outside `tests/`.
**Carried to Day 3 (recorded, not Arcanum bugs):** no forward secrecy against later theft of both static
secret keys (a fresh exchange with an ephemeral key pair per epoch); no key-confirmation message; epoch
state and the replay window (A-12, A-13) live in the engine; `Initiation<'a>` borrows the secret key, which
may need an owned variant in async code (a 0.x API change).
**Not verified:** constant time (QA A-32, dudect, belongs in the Day 7 audit pack on a quiet Linux box);
anything on Linux; FIPS 203 from the NIST PDF; RFC 7748's 1,000,000-iteration vector; interop with a
non-Rust X-Wing. There is no CI: every number here was run by hand.
## 2026-11-25 — Day 1 built (builder), reviewed twice (QA)
The builder's PR (67 tests, 661 s of fuzzing) and two QA reviews: the first QA attack plan
(`Via/qa/01_arcanum_attacks.md`), and the second review (`Via/qa/review-arcanum-pr1.md`, findings R2-01 to
R2-05, comments #49902–#49909), answered in `6780abc` and `96086be` (replies #49927–#49931, summary #49951).