Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 7 additions & 2 deletions crates/attestation/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,16 @@ serde_json = "1.0.145"
thiserror = "2.0.17"
tracing = "0.1.41"
ureq = "3.5.0"
# GCP firmware endorsement verification
x509-parser = { version = "0.18.0", features = ["verify"] }
sha2 = "0.10"
prost = "0.14"
rsa = "0.9"

mock-tdx = { workspace = true, optional = true }

# For optional Azure support
rustls-pki-types = { version = "1.14.0", optional = true }
x509-parser = { version = "0.18.0", optional = true }
webpki = { package = "rustls-webpki", version = "0.103.8", optional = true }
num-bigint = { version = "0.4.6", optional = true }
base64 = { version = "0.22.1", optional = true }
Expand All @@ -54,6 +58,8 @@ tss-esapi = { version = "7.6.0", optional = true }

[dev-dependencies]
base64 = "0.22.1"
rcgen = { version = "0.14.7", features = ["x509-parser"] }
time = "0.3.47"
mock-tdx = { workspace = true }
tempfile = "3.23.0"
rustls = { workspace = true, default-features = false, features = ["aws_lc_rs"] }
Expand Down Expand Up @@ -84,7 +90,6 @@ azure-verifier = [
"dep:pem-rfc7468",
"dep:rustls-pki-types",
"dep:webpki",
"dep:x509-parser",
]

# Deprecated alias for `azure-attester`, kept only for backwards
Expand Down
17 changes: 15 additions & 2 deletions crates/attestation/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,9 @@ a node replaying a log whose state depended on that verdict, or a third party
re-checking published evidence without trusting whoever verified it first. It
says whether the evidence was valid when first verified, not whether the
platform is trustworthy now: collateral that has since expired or been revoked
still passes. GCP evidence is not supported: its provenance registry is
unsigned and mutable, so a replay cannot reproduce that check.
still passes. GCP evidence is re-checked against the firmware endorsement
recorded in the snapshot, while the provenance lookup is skipped: Google's
registry is unsigned and mutable, and the original verification consulted it.

Matched expected measurements can be transported in an HTTP header using
`ExpectedMeasurements::to_header_format` and reconstructed with
Expand Down Expand Up @@ -171,6 +172,18 @@ used, the quote will fail to verify. For special cases where outdated TCB
should be allowed, a custom override function can be passed when verifying
which may modify collateral before it is validated against the TCB.

A `gcp-tdx` verification also establishes that the quote comes from Google's
fleet and from firmware Google built. The PCK certificate's PPID must appear in
Google's confidential-host registry, and the quote's MRTD must be named by the
`VMLaunchEndorsement` Google publishes for it, signed under the
`GCE-cc-tcb-root_1` certificate compiled in from
[`assets/GCE-cc-tcb-root_1.crt`](assets/GCE-cc-tcb-root_1.crt) (published at
`https://pki.goog/cloud_integrity/GCE-cc-tcb-root_1.crt`, SHA-256
`e876bc6978bf4f3da445f98a0a82363c8c0bae5a1fc033c6df65846a6cb0f18c`). The
endorsement is fetched once per MRTD, verified at the verification instant,
recorded in the `EndorsementSnapshot`, and re-verified at that instant when
archived evidence is replayed.

## Measurements File

Accepted measurements for the remote party can be specified in a JSON file
Expand Down
Binary file added crates/attestation/assets/GCE-cc-tcb-root_1.crt
Binary file not shown.
22 changes: 14 additions & 8 deletions crates/attestation/src/azure/ak_certificate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,21 @@ const MICROSOFT_RSA_DEVICES_ROOT_2021: &str =
pub(super) const AZURE_VIRTUAL_TPM_ROOT_2023: &str =
include_str!("../../assets/azure-virtual-tpm-root-2023.pem");

/// The root CAs an AK certificate chain is verified against, as compiled
/// in: each asset's file stem and its PEM text, in anchor order
///
/// Compiled in rather than fetched, so they are the one verification input
/// a relying party cannot archive beside the evidence. Exported so such a
/// party can record which anchors a verdict rested on — a replay needs a
/// build carrying the same ones.
pub const AZURE_ROOT_CA_PEMS: [(&str, &str); 2] = [
("microsoft-rsa-devices-root-ca-2021", MICROSOFT_RSA_DEVICES_ROOT_2021),
("azure-virtual-tpm-root-2023", AZURE_VIRTUAL_TPM_ROOT_2023),
];

/// The root anchors for azure
static AZURE_ROOT_ANCHORS: Lazy<Vec<TrustAnchor<'static>>> = Lazy::new(|| {
vec![
// Microsoft RSA Devices Root CA 2021 (older VMs)
pem_to_trust_anchor(MICROSOFT_RSA_DEVICES_ROOT_2021),
// Azure Virtual TPM Root CA 2023 (TDX + newer trusted launch)
pem_to_trust_anchor(AZURE_VIRTUAL_TPM_ROOT_2023),
]
});
static AZURE_ROOT_ANCHORS: Lazy<Vec<TrustAnchor<'static>>> =
Lazy::new(|| AZURE_ROOT_CA_PEMS.iter().map(|(_, pem)| pem_to_trust_anchor(pem)).collect());

/// Verify an AK certificate against pinned Azure root CAs.
///
Expand Down
1 change: 1 addition & 0 deletions crates/attestation/src/azure/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ mod tpm_quote;
mod tpms_attest;
mod verify;

pub use ak_certificate::AZURE_ROOT_CA_PEMS;
#[cfg(azure_attester_x86_64_linux)]
pub use attester::{create_azure_attestation, detect_azure_cvm};
use az_cvm_vtpm::hcl;
Expand Down
2 changes: 1 addition & 1 deletion crates/attestation/src/azure/verify.rs
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ mod tests {
let err = verify_azure_attestation_archived(
input,
[0; 64],
&EndorsementSnapshot { at: 0, dcap: None },
&EndorsementSnapshot { at: 0, dcap: None, gcp_firmware: None },
false,
)
.unwrap_err();
Expand Down
2 changes: 1 addition & 1 deletion crates/attestation/src/dcap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,7 @@ mod tests {
/// fetch
#[test]
fn archived_without_collateral_is_refused() {
let endorsements = EndorsementSnapshot { at: 0, dcap: None };
let endorsements = EndorsementSnapshot { at: 0, dcap: None, gcp_firmware: None };

let err = verify_dcap_attestation_archived(Vec::new(), [0; 64], &endorsements).unwrap_err();

Expand Down
Loading
Loading