omne_attest/lib.rs
1//! **Verify an AMD SEV-SNP attestation report against AMD's own key chain —
2//! locally, with no oracle and nothing to trust but the root you pin.**
3//!
4//! This crate is the attestation layer of [Omne](https://omne.foundation), a
5//! foundation-level substrate that can be built on. It is published on its own
6//! because it is useful on its own: if you rent a confidential VM from anyone,
7//! this tells you whether the thing that answered you is really a SEV-SNP
8//! enclave running the image you expected.
9//!
10//! Two layers:
11//!
12//! - [`snp`] — the report itself. Parse the 1,184-byte `ATTESTATION_REPORT`,
13//! verify its ECDSA-P384 signature under the chip's VCEK, verify
14//! VCEK ← ASK ← ARK against a **pinned** root, check the VCEK really is
15//! this chip's key at this TCB, then apply the relying party's policy.
16//! Every failure is a named variant of [`snp::Fail`] — you are told which
17//! leg failed, never just "invalid".
18//!
19//! - [`claim`] — the *attested claim*: a report bound to a specific rental, a
20//! specific buyer nonce, and a specific ML-KEM-768 encapsulation key, so a
21//! buyer can send a job key to an enclave it has just verified and to
22//! nothing else. Replay of an old report is refused at the binding leg.
23//!
24//! ## What this crate does not decide
25//!
26//! Whether to trust AMD. It pins the root **you** supply and reports exactly
27//! which check failed. The chip's own signature is ECDSA-P384 and the chain
28//! is RSASSA-PSS — those are AMD's algorithms, not ours; Omne's own
29//! signatures are ML-DSA and the job-key exchange here is ML-KEM-768.
30//!
31//! ## Example
32//!
33//! ```no_run
34//! use omne_attest::{claim, snp};
35//! # fn main() -> Result<(), Box<dyn std::error::Error>> {
36//! # let (bytes, rental, nonce, expected_measurement, ark_pin) =
37//! # (vec![], [0u8; 32], [0u8; 32], [0u8; 48], [0u8; 32]);
38//! let c = claim::AttestedClaim::decode(&bytes).ok_or("malformed claim")?;
39//! let policy = claim::BuyerPolicy {
40//! measurement: expected_measurement,
41//! tcb_floor: snp::Tcb { boot_loader: 0, tee: 0, snp: 0, microcode: 0 },
42//! ark_sha256: ark_pin,
43//! reject_debug: true,
44//! };
45//! let verified = claim::verify(&c, &rental, &nonce, &policy)?;
46//! let (ciphertext, job_key) = claim::encapsulate_job_key(&verified.ek)?;
47//! # Ok(()) }
48//! ```
49
50pub mod claim;
51pub mod snp;