Skip to content

Commit

Permalink
Attester/TDX: add AA eventlog support
Browse files Browse the repository at this point in the history
Signed-off-by: Xynnn007 <[email protected]>
  • Loading branch information
Xynnn007 committed Jul 8, 2024
1 parent dbc41a4 commit 2a4fac1
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion attestation-agent/attester/src/tdx/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ use anyhow::*;
use base64::Engine;
use scroll::Pread;
use serde::{Deserialize, Serialize};
use std::fs;
use std::path::Path;
use tdx_attest_rs::tdx_report_t;

Expand Down Expand Up @@ -54,13 +55,17 @@ fn runtime_measurement_extend_available() -> bool {
true
}

pub const DEFAULT_EVENTLOG_PATH: &str = "/run/attestation-agent/eventlog";

#[derive(Serialize, Deserialize)]
struct TdxEvidence {
// Base64 encoded CC Eventlog ACPI table
// refer to https://uefi.org/specs/ACPI/6.5/05_ACPI_Software_Programming_Model.html#cc-event-log-acpi-table.
cc_eventlog: Option<String>,
// Base64 encoded TD quote.
quote: String,
// Eventlog of Attestation Agent
aa_eventlog: Option<String>,
}

#[derive(Debug, Default)]
Expand Down Expand Up @@ -97,7 +102,19 @@ impl Attester for TdxAttester {
}
};

let evidence = TdxEvidence { cc_eventlog, quote };
let aa_eventlog = match fs::read_to_string(DEFAULT_EVENTLOG_PATH) {
Result::Ok(el) => Some(el),
Result::Err(e) => {
log::warn!("Read AA Eventlog failed: {:?}", e);
None
}
};

let evidence = TdxEvidence {
cc_eventlog,
quote,
aa_eventlog,
};

serde_json::to_string(&evidence).context("Serialize TDX evidence failed")
}
Expand Down

0 comments on commit 2a4fac1

Please sign in to comment.