sandbox-tee: check a TDX quote's PCK chain to a pinned Intel root #415

Merged
dcharlot merged 1 commit from feat/tdx-pck-chain into main 2026-10-22 06:51:25 -04:00

2026-10-21

Transaction Science
sandbox-tee: check a TDX quote's PCK chain to a pinned Intel root
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
#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