5a52854ccc
arcanum::sign, as docs/02_signatures.md sets out. M' = Prefix || Label || u8(len ctx) || ctx || SHA-512(M), built on the stack. The ML-DSA-65 half is ExpandedSigningKey::sign_randomized(M', ctx = Label, rng), hedged; the Ed25519 half is pure Ed25519 over M' (try_sign), checked with verify_strict. Verification computes both halves before answering, and returns one InvalidSignature whichever failed. ml-dsa's Signer/Verifier traits, sign_deterministic and sign_mu_deterministic are never called. - SigningKey: two 32-byte seeds (RFC 10073's private key format), the expanded ML-DSA key boxed; ZeroizeOnDrop, not Clone, Debug redacted. - VerifyingKey: 1984 bytes; refuses an Ed25519 half that is not a point, not its canonical encoding, or of small order (InvalidVerifyingKey). - AppContext: only "domi/arcanum/v2/sig/app/" + a 1..=231-byte label. - bind_kem_key / verify_binding: an X-Wing public key bound to a key id and an inclusive validity window under "domi/arcanum/v2/sig/kem-key"; the message is hashed field by field; window and id are checked first, then the signature, then now (InvalidValidity, TooLong, InvalidSignature, OutsideValidity). - sign_composite_raw / verify_composite_raw: the bare RFC ctx, hazmat only. They still take an RNG (the ML-DSA half stays hedged), not the deterministic variant the doc mentions. - Error gains TooLong, InvalidVerifyingKey, InvalidSignature, SigningFailed, InvalidValidity, OutsideValidity; Input gains SigningKey, VerifyingKey, Signature, Context, KeyId. Also fixes tests/kat_mldsa65.rs, which passed a &[&Vec<u8>] to sign_internal and did not compile. cargo test (debug): 121 passed, 0 failed (82 from v0.1.0, golden_v1 unchanged). clippy --all-targets --all-features -D warnings: clean.
53 lines
2.6 KiB
TOML
53 lines
2.6 KiB
TOML
[package]
|
|
name = "arcanum"
|
|
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, 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
|
|
|
|
[dependencies]
|
|
# Primitives: every one from a vetted crate, none written here (docs/01_arcanum.md).
|
|
ml-kem = { version = "=0.3.4", default-features = false, features = ["zeroize"] }
|
|
x25519-dalek = { version = "=3.0.0", default-features = false, features = ["static_secrets", "zeroize"] }
|
|
sha3 = { version = "0.12", default-features = false, features = ["zeroize"] }
|
|
shake = { version = "0.1", default-features = false, features = ["zeroize"] }
|
|
sha2 = { version = "0.11", default-features = false, features = ["zeroize"] }
|
|
hkdf = { version = "0.13", default-features = false }
|
|
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`) and the bare RFC 10073 signature interface
|
|
# (`sign_composite_raw`, `verify_composite_raw`) for the known-answer tests. Off by default;
|
|
# never enable it in a release build (tests/feature_hygiene.rs checks the normal dependency graph).
|
|
hazmat = []
|
|
|
|
[dev-dependencies]
|
|
# The tests enable `hazmat` on the crate itself; dev-dependencies never reach a normal build.
|
|
arcanum = { path = ".", features = ["hazmat"] }
|
|
# Reference implementation for the differential test only; never linked into the library.
|
|
x-wing = { version = "=0.1.1" }
|
|
chacha20 = { version = "0.10", default-features = false, features = ["rng"] }
|
|
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."*"]
|
|
opt-level = 2
|
|
[profile.test.package."*"]
|
|
opt-level = 2
|