@@ -33,8 +33,7 @@ pub use tpm_types::TpmQuote;
3333
3434use crate :: amd_sev_snp:: { AmdKdsClient , VerifiedAmdSnpReport } ;
3535use crate :: v1:: {
36- is_tdx_acpi_data_event, is_tdx_lite_config, strip_tdx_event_log_for_config,
37- strip_tdx_runtime_event_log,
36+ is_tdx_acpi_data_event, strip_tdx_event_log_for_config, strip_tdx_runtime_event_log,
3837} ;
3938pub use crate :: v1:: { Attestation as AttestationV1 , PlatformEvidence , StackEvidence } ;
4039
@@ -1178,19 +1177,24 @@ impl<T> Attestation<T> {
11781177
11791178 /// Get TDX event log string for a vm_config.
11801179 ///
1181- /// In lite mode, keep the `ACPI DATA` marker payloads in RTMR0 so callers
1182- /// that still consume the top-level `event_log` can semantically identify
1183- /// the ACPI table digest events without consulting the versioned
1184- /// attestation field.
1185- pub fn get_tdx_event_log_string_for_config ( & self , config : & str ) -> Option < String > {
1180+ /// Always keeps the `ACPI DATA` marker payloads on the three RTMR0 ACPI
1181+ /// digest events, regardless of the vm_config's `tdx_attestation_variant`,
1182+ /// so callers that consume the top-level `event_log` can semantically
1183+ /// identify the ACPI table digest events without consulting the
1184+ /// versioned attestation field, and a verifier can choose lite
1185+ /// verification for any TDX boot rather than only ones resolved to lite
1186+ /// at launch.
1187+ ///
1188+ /// `config` is accepted for API stability but no longer changes the
1189+ /// result.
1190+ pub fn get_tdx_event_log_string_for_config ( & self , _config : & str ) -> Option < String > {
11861191 self . tdx_quote ( ) . map ( |q| {
1187- let keep_lite_acpi_payload = is_tdx_lite_config ( config) ;
11881192 let stripped: Vec < _ > = q
11891193 . event_log
11901194 . iter ( )
11911195 . map ( |e| {
11921196 let mut stripped = e. stripped ( ) ;
1193- if keep_lite_acpi_payload && is_tdx_acpi_data_event ( e) {
1197+ if is_tdx_acpi_data_event ( e) {
11941198 stripped. event_payload = e. event_payload . clone ( ) ;
11951199 }
11961200 stripped
@@ -2117,7 +2121,7 @@ mod tests {
21172121 }
21182122
21192123 #[ test]
2120- fn tdx_event_log_string_for_lite_keeps_acpi_data_payloads ( ) {
2124+ fn tdx_event_log_string_always_keeps_acpi_data_payloads ( ) {
21212125 let mut attestation = dummy_tdx_attestation ( [ 0u8 ; 64 ] ) ;
21222126 let AttestationQuote :: DstackTdx ( tdx_quote) = & mut attestation. quote else {
21232127 panic ! ( "expected TDX attestation" ) ;
@@ -2128,23 +2132,27 @@ mod tests {
21282132 tdx_event( 3 , 8 , b"runtime-payload" ) ,
21292133 ] ;
21302134
2131- let lite_events: Vec < TdxEvent > = serde_json:: from_str (
2132- & attestation
2133- . get_tdx_event_log_string_for_config ( r#"{"tdx_attestation_variant":"lite"}"# )
2134- . expect ( "TDX event log" ) ,
2135- )
2136- . expect ( "decode lite event log" ) ;
2137- assert_eq ! ( lite_events[ 0 ] . event_payload, b"ACPI DATA" ) ;
2138- assert ! ( lite_events[ 1 ] . event_payload. is_empty( ) ) ;
2139- assert ! ( lite_events[ 2 ] . event_payload. is_empty( ) ) ;
2140-
2141- let legacy_events: Vec < TdxEvent > = serde_json:: from_str (
2142- & attestation
2143- . get_tdx_event_log_string ( )
2144- . expect ( "TDX event log" ) ,
2145- )
2146- . expect ( "decode legacy event log" ) ;
2147- assert ! ( legacy_events[ 0 ] . event_payload. is_empty( ) ) ;
2135+ // The ACPI DATA marker payload is retained regardless of the
2136+ // vm_config's tdx_attestation_variant (including no vm_config at
2137+ // all), so a verifier can choose lite verification for any TDX boot.
2138+ for config in [
2139+ r#"{"tdx_attestation_variant":"lite"}"# ,
2140+ r#"{"tdx_attestation_variant":"legacy"}"# ,
2141+ "" ,
2142+ ] {
2143+ let events: Vec < TdxEvent > = serde_json:: from_str (
2144+ & attestation
2145+ . get_tdx_event_log_string_for_config ( config)
2146+ . expect ( "TDX event log" ) ,
2147+ )
2148+ . unwrap_or_else ( |e| panic ! ( "decode event log for config {config:?}: {e}" ) ) ;
2149+ assert_eq ! (
2150+ events[ 0 ] . event_payload, b"ACPI DATA" ,
2151+ "config {config:?} must keep the ACPI DATA marker payload"
2152+ ) ;
2153+ assert ! ( events[ 1 ] . event_payload. is_empty( ) ) ;
2154+ assert ! ( events[ 2 ] . event_payload. is_empty( ) ) ;
2155+ }
21482156 }
21492157
21502158 #[ test]
0 commit comments