open-standards/sandbox/sandbox-rs/crates/sandbox-tee/Cargo.toml
Transaction Science ff06055e5c
All checks were successful
standards workspaces build + test / which workspaces this change touches (pull_request) Successful in 14s
repository checks / lockfiles, tests in CI, workflow hygiene, spec and section references, public text (pull_request) Successful in 1m31s
standards workspaces build + test / arl-rs (arl/arl-rs, arl-rs, linux) (pull_request) Successful in 1m12s
standards workspaces build + test / eoc-rs (eoc/eoc-rs, -p eoc-meter --features cuda, eoc-rs, linux) (pull_request) Successful in 2m10s
standards workspaces build + test / jcp-rs (jcp-conformance, jcp/jcp-rs, -p jcp-energy --features nvml, jcp-rs, linux) (pull_request) Successful in 1m40s
standards workspaces build + test / joule-ui-rs (joule-ui/joule-ui-rs, joule-ui-rs, linux) (pull_request) Successful in 1m16s
standards workspaces build + test / joulehook-rs (joulehook/joulehook-rs, joulehook-rs, linux) (pull_request) Successful in 1m13s
standards workspaces build + test / pool-rs (pool/pool-rs, pool-rs, linux) (pull_request) Successful in 1m10s
standards workspaces build + test / proof-rs (proof-conformance, proof/proof-rs, proof-rs, linux, true) (pull_request) Successful in 1m30s
standards workspaces build + test / sense-rs (sense/sense-rs, sense-rs, linux) (pull_request) Successful in 1m12s
standards workspaces build + test / sandbox-rs (sandbox-conformance, sandbox/sandbox-rs, -p sandbox-tee --features amd-kds,intel-pcs, sandbox-rs, linux) (pull_request) Successful in 2m43s
standards workspaces build + test / smart-byte-rs (smart-byte/smart-byte-rs, smart-byte-rs, linux) (pull_request) Successful in 4m16s
standards workspaces build + test / jouleclaw-rs (-nodebug, jouleclaw/jouleclaw-rs, -p jouleclaw-energy --features rapl,nvml, jouleclaw-rs, linux-arm64, -C target-feature=+fp16) (pull_request) Successful in 4m40s
standards workspaces build + test / aac-rs (aac-conformance, aac/aac-rs, aac-rs, linux-arm64) (pull_request) Successful in 5m7s
standards workspaces build + test / joulecontract-rs (joulecontract/joulecontract-rs, joulecontract-rs, linux-arm64, true) (pull_request) Successful in 1m3s
standards workspaces build + test / map-rs (map-conformance, map/map-rs, map-rs, linux-arm64) (pull_request) Successful in 59s
standards workspaces build + test / joule-code-rs (joule-code/joule-code-rs, joule-code-rs, linux-arm64, true) (pull_request) Successful in 3m17s
standards workspaces build + test / mesh-rs (mesh/mesh-rs, -p mesh-engine-gguf -p mesh-openai --features mesh-engine-gguf/gguf,mesh-openai/server, mesh-rs, linux-arm64) (pull_request) Successful in 1m0s
standards workspaces build + test / openpay (openpay, openpay, linux-arm64) (pull_request) Successful in 3m37s
standards workspaces build + test / macOS energy backends (pull_request) Successful in 12m40s
standards workspaces build + test / jouledesk-rs (jouledesk/jouledesk-rs, jouledesk-rs, macos) (pull_request) Successful in 3m19s
sandbox-tee: check a TDX quote's PCK chain to a pinned Intel root
#399 made verify_tdx trust only a PCK key the verifier pins, but left
pinning it to the deployment: a hand pin, with nothing checking the
quote's certificate chain to Intel's root. The SEV-SNP side has amd_kds
for exactly this.

intel_pcs (feature `intel-pcs`):
- verify_pck_chain(trusted_root_der, chain_pem, now_unix) checks the chain
  a quote carries, the PCK leaf then its issuing CA, optionally ending in
  the root, to the pinned root. It checks:
  - ECDSA-P256-SHA256 signatures, with the X.509 (r, s) decoded via der;
  - the declared algorithm;
  - issuer and subject names linking up the chain;
  - each certificate valid at now.
  A presented root must equal the pinned one byte for byte; a longer chain
  is refused. It returns the PCK key, the TeeAnchor::Tdx a quote is
  verified by.
- pck_from_quote derives that anchor from the quote's own chain, checked
  to the root. The trust comes from the root, never from the quote.
- Revocation lists are the deployment's to consult, as stated in the
  module.

tdx: TdxQuote::pck_chain(); local_quote takes optional certification data,
so a software quote can carry a real chain.

CI: the sandbox-rs job now runs `cargo test -p sandbox-tee --features
amd-kds,intel-pcs`. The amd-kds tests had never run in CI: a plain
`cargo test` does not enable the feature.

SPEC §7.6 and the §9 readiness row say the chain is checked.

Tests: 5, against a self-generated chain of Intel's structure:
- a chain to the pinned root yields the PCK, with or without the root;
- a chain to another root is refused, pinned or presented;
- every link must hold (a forged leaf or CA, a misnamed issuer, a missing
  CA, a chain too long, a relabeled algorithm);
- a chain outside its validity is refused;
- the anchor from a quote's chain verifies that quote and no other root
  yields one.
Mutation testing: 10 mutants, all killed.

Verified on the build host: sandbox-tee with amd-kds and intel-pcs, 51
tests; the sandbox workspace, 434; clippy -D warnings clean. Repo checks
pass, including workflow concurrency and lockfiles.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-21 19:11:54 -04:00

51 lines
2.4 KiB
TOML

[package]
name = "sandbox-tee"
version.workspace = true
edition.workspace = true
license.workspace = true
repository.workspace = true
rust-version.workspace = true
description = "Sandbox — S6 confidential-tier TEE evidence: SEV-SNP report (ECDSA-P384) + Intel TDX DCAP-v4 quote (ECDSA-P256) verification, NVIDIA GPU EAT (ES384) accelerator attestation, policy, and report providers (SPEC §2.2 S6, §7.6)."
[dependencies]
sandbox-schema.workspace = true
sandbox-attest.workspace = true
p384.workspace = true
p256.workspace = true
sha2.workspace = true
base64.workspace = true
serde_json.workspace = true
hex.workspace = true
thiserror.workspace = true
# AMD SEV-SNP KDS cert-chain verification (the `amd-kds` feature, off by default):
# real X.509 DER parsing + RSA-4096 RSASSA-PSS/SHA-384 verification for the
# ARK -> ASK -> VCEK chain. Heavy (rsa/x509-cert), so gated so no ordinary
# consumer pays for it. `builder` is enabled for the self-generated test chain.
rsa = { version = "0.9", optional = true, features = ["sha2"] }
x509-cert = { version = "0.2", optional = true, features = ["builder"] }
spki = { version = "0.7", optional = true }
der = { version = "0.7", optional = true }
signature = { version = "2", optional = true }
[features]
# AMD KDS cert-chain verification (SEV-SNP): turns a genuine AMD ARK->ASK->VCEK
# chain into a hardware-grounded verifying key for the `chain`/grounding machinery.
amd-kds = ["dep:rsa", "dep:x509-cert", "dep:spki", "dep:der", "dep:signature"]
# Intel PCK cert-chain verification (TDX): checks the PCK chain a quote carries
# to a pinned Intel root, so the TDX anchor is derived rather than pinned by hand.
# ECDSA-P256 throughout, so it needs the X.509 parsing and not the RSA stack.
intel-pcs = ["dep:x509-cert", "dep:spki", "dep:der"]
# Dev-only, for the `attested_efficiency` example: composes this crate's energy
# attestation with the efficiency/1 receipt (jcp-rs), over a figure this host's
# meter (sandbox-meter) read for a task the example runs. Dev-dependencies, so
# no consumer of sandbox-tee pulls jcp-efficiency or the meter, and the receipt
# crate stays free of any dependency on the attestation layer.
[dev-dependencies]
jcp-efficiency = { path = "../../../../jcp/jcp-rs/crates/jcp-efficiency" }
sandbox-meter.workspace = true
jcp-schema = { path = "../../../../jcp/jcp-rs/crates/jcp-schema" }
ed25519-dalek = "2"
# RNG for generating the self-signed AMD-structured test chain (RSA/EC keygen).
rand = "0.8"