Skip to content

Commit

Permalink
AA/attester: move CCEL read logic to eventlog_rs crate
Browse files Browse the repository at this point in the history
eventlog_rs is a crate to support eventlog related parsing and read
APIs.

Signed-off-by: Xynnn007 <[email protected]>
  • Loading branch information
Xynnn007 committed Jan 3, 2025
1 parent 3cfbbfa commit ddafd36
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 4 deletions.
31 changes: 30 additions & 1 deletion Cargo.lock

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

3 changes: 2 additions & 1 deletion attestation-agent/attester/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ az-snp-vtpm = { version = "0.7.1", default-features = false, features = ["attest
az-tdx-vtpm = { version = "0.7.0", default-features = false, features = ["attester"], optional = true }
base64.workspace = true
clap = { workspace = true, features = ["derive"], optional = true }
eventlog-rs = { version = "0.1.6", optional = true }
hex.workspace = true
kbs-types.workspace = true
log.workspace = true
Expand Down Expand Up @@ -59,7 +60,7 @@ all-attesters = [
# quotes. It's an unconditional dependency for tdx-attester since that is the only way to
# generate TDX quotes with upstream kernels.
tsm-report = ["tempfile"]
tdx-attester = ["scroll", "tsm-report", "tdx-attest-rs"]
tdx-attester = ["scroll", "tsm-report", "tdx-attest-rs", "eventlog-rs"]
sgx-attester = ["occlum_dcap"]
az-snp-vtpm-attester = ["az-snp-vtpm"]
az-tdx-vtpm-attester = ["az-snp-vtpm-attester", "az-tdx-vtpm"]
Expand Down
3 changes: 1 addition & 2 deletions attestation-agent/attester/src/tdx/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ mod report;
mod rtmr;

const TDX_REPORT_DATA_SIZE: usize = 64;
const CCEL_PATH: &str = "/sys/firmware/acpi/tables/data/CCEL";

pub fn detect_platform() -> bool {
TsmReportPath::new(TsmReportProvider::Tdx).is_ok() || Path::new("/dev/tdx_guest").exists()
Expand Down Expand Up @@ -129,7 +128,7 @@ impl Attester for TdxAttester {
let engine = base64::engine::general_purpose::STANDARD;
let quote = engine.encode(quote_bytes);

let cc_eventlog = match std::fs::read(CCEL_PATH) {
let cc_eventlog = match eventlog_rs::read::read_ccel() {
Result::Ok(el) => Some(engine.encode(el)),
Result::Err(e) => {
log::warn!("Read CC Eventlog failed: {:?}", e);
Expand Down

0 comments on commit ddafd36

Please sign in to comment.