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.
This commit is contained in:
2026-11-25 12:48:39 +01:00
parent 5b9e3ee8fb
commit 2a432f5d86
13 changed files with 1482 additions and 4 deletions
+8 -2
View File
@@ -1,10 +1,10 @@
[package]
name = "arcanum"
version = "0.1.0"
version = "0.2.0"
edition = "2024"
rust-version = "1.88"
license = "CPAL-1.0"
description = "Hybrid post-quantum key exchange (X-Wing: ML-KEM-768 + X25519), key schedule, WireGuard PSK derivation and sealing for the Domi ecosystem"
description = "Hybrid post-quantum key exchange (X-Wing: ML-KEM-768 + X25519), key schedule, WireGuard PSK derivation, sealing and hybrid signatures (ML-DSA-65 + Ed25519, RFC 10073) for the Domi ecosystem"
repository = "https://gitea.marek-novak.cz/mnovak/arcanum"
readme = "README.md"
publish = false
@@ -21,6 +21,10 @@ hmac = { version = "0.13", default-features = false, features = ["zeroize"] }
chacha20poly1305 = { version = "0.11", default-features = false, features = ["alloc", "zeroize"] }
rand_core = { version = "0.10", default-features = false }
zeroize = { version = "1.8", default-features = false, features = ["alloc", "zeroize_derive"] }
# v0.2.0 signatures (docs/02_signatures.md): ML-DSA-65 (FIPS 204) and Ed25519 (RFC 8032), combined as
# RFC 10073 id-MLDSA65-Ed25519-SHA512. Pinned exactly; `zeroize` is opt-in in ml-dsa and must stay on.
ml-dsa = { version = "=0.1.2", default-features = false, features = ["alloc", "rand_core", "zeroize"] }
ed25519-dalek = { version = "=3.0.0", default-features = false, features = ["zeroize"] }
[features]
# Deterministic entry points (`_derand`, `from_seed`) for the known-answer tests. Off by default;
@@ -37,6 +41,8 @@ serde = { version = "1", features = ["derive"] }
serde_json = "1"
hex = "0.4"
sha2 = "0.11"
# The RFC 10073 vectors are base64.
base64 = "0.22"
# ML-KEM in a debug build is slow; the byte-flip tests run thousands of exchanges.
[profile.dev.package."*"]