feat: X-Wing (draft -11), mutual exchange, WireGuard PSK per epoch, sealed box

X-Wing is composed from ml-kem, x25519-dalek, sha3 and shake and matches the
draft's vectors. The PSK comes from a mutual exchange (each peer encapsulates
to the other, QA A-15) bound to the full transcript in Arcanum's own HKDF layer
(QA D-QA-1). Low-order X25519 values are refused. Deterministic entry points
sit behind the off-by-default hazmat feature, enabled only for the tests.
This commit is contained in:
2026-11-25 07:38:55 +01:00
parent c7d050ed65
commit 89b5329f06
15 changed files with 1316 additions and 118 deletions
+42
View File
@@ -1 +1,43 @@
//! # Arcanum
//!
//! The post-quantum crypto core of the Domi ecosystem. **Not audited.**
//!
//! - [`xwing`]: the hybrid KEM ML-KEM-768 + X25519 (X-Wing, draft-connolly-cfrg-xwing-kem-11).
//! - [`exchange`]: a mutual exchange between two peers (each encapsulates to the other), bound to
//! the full transcript and a context, and the WireGuard pre-shared key it yields per epoch.
//! - [`seal`]: a one-shot sealed box to a recipient's hybrid public key.
//!
//! No primitive is implemented here; they come from `ml-kem`, `x25519-dalek`, `sha3`, `shake`,
//! `sha2`, `hkdf` and `chacha20poly1305`. No I/O, no clock: randomness and time are parameters.
//! Design, sources and risks: `docs/01_arcanum.md` and `docs/THREAT_MODEL.md`.
//!
//! The `hazmat` feature exposes the deterministic (`_derand`, `from_seed`) entry points used by
//! the known-answer tests. It is off by default and must never be enabled in a release build.
#![no_std]
#![forbid(unsafe_code)]
#![deny(missing_docs)]
extern crate alloc;
mod error;
pub mod exchange;
mod schedule;
pub mod seal;
pub mod xwing;
#[cfg(test)]
mod binding_tests;
pub use error::{Error, Input};
pub use exchange::{Session, WIREGUARD_PSK_LEN, WireGuardPsk};
/// The recommended rotation interval in seconds. Rosenpass's responder rekeys every 120 s
/// (`REKEY_AFTER_TIME_RESPONDER`), following WireGuard's own two-minute rekey.
pub const RECOMMENDED_EPOCH_SECONDS: u64 = 120;
/// The epoch number at `unix_seconds`, for [`Session::wireguard_psk`]. Arcanum has no clock; the
/// caller passes the time.
#[must_use]
pub const fn epoch_at(unix_seconds: u64) -> u64 {
unix_seconds / RECOMMENDED_EPOCH_SECONDS
}