MCPcopy Create free account
hub / github.com/Dstack-TEE/dstack / measure_with_logs

Method measure_with_logs

dstack-mr/src/machine.rs:100–141  ·  view source on GitHub ↗
(&self)

Source from the content-addressed store, hash-verified

98 }
99
100 pub fn measure_with_logs(&self) -> Result<TdxMeasurementDetails> {
101 debug!("measuring machine: {self:#?}");
102 let fw_data = fs::read(self.firmware)?;
103 let kernel_data = fs::read(self.kernel)?;
104 let initrd_data = fs::read(self.initrd)?;
105 let tdvf = Tdvf::parse(&fw_data).context("Failed to parse TDVF metadata")?;
106
107 let mrtd = tdvf.mrtd(self).context("Failed to compute MR TD")?;
108
109 let (rtmr0_log, acpi_tables) = tdvf
110 .rtmr0_log(self)
111 .context("Failed to compute RTMR0 log")?;
112 debug_print_log("RTMR0", &rtmr0_log);
113 let rtmr0 = measure_log(&rtmr0_log);
114
115 let rtmr1_log = kernel::rtmr1_log(
116 &kernel_data,
117 initrd_data.len() as u32,
118 self.memory_size,
119 0x28000,
120 )?;
121 debug_print_log("RTMR1", &rtmr1_log);
122 let rtmr1 = measure_log(&rtmr1_log);
123
124 let rtmr2_log = vec![
125 kernel::measure_cmdline(self.kernel_cmdline),
126 measure_sha384(&initrd_data),
127 ];
128 debug_print_log("RTMR2", &rtmr2_log);
129 let rtmr2 = measure_log(&rtmr2_log);
130
131 Ok(TdxMeasurementDetails {
132 measurements: TdxMeasurements {
133 mrtd,
134 rtmr0,
135 rtmr1,
136 rtmr2,
137 },
138 rtmr_logs: [rtmr0_log, rtmr1_log, rtmr2_log],
139 acpi_tables,
140 })
141 }
142}

Callers 2

measureMethod · 0.80

Calls 6

debug_print_logFunction · 0.85
measure_logFunction · 0.85
rtmr1_logFunction · 0.85
mrtdMethod · 0.80
rtmr0_logMethod · 0.80
lenMethod · 0.45

Tested by

no test coverage detected