Measures a QEMU-patched TDX kernel image.
(
kernel_data: &[u8],
initrd_size: u32,
mem_size: u64,
acpi_data_size: u32,
)
| 213 | |
| 214 | /// Measures a QEMU-patched TDX kernel image. |
| 215 | pub(crate) fn rtmr1_log( |
| 216 | kernel_data: &[u8], |
| 217 | initrd_size: u32, |
| 218 | mem_size: u64, |
| 219 | acpi_data_size: u32, |
| 220 | ) -> Result<Vec<Vec<u8>>> { |
| 221 | let kd = patch_kernel(kernel_data, initrd_size, mem_size, acpi_data_size) |
| 222 | .context("Failed to patch kernel")?; |
| 223 | let kernel_hash = authenticode_sha384_hash(&kd).context("Failed to compute kernel hash")?; |
| 224 | Ok(vec![ |
| 225 | kernel_hash, |
| 226 | measure_sha384(b"Calling EFI Application from Boot Option"), |
| 227 | measure_sha384(&[0x00, 0x00, 0x00, 0x00]), // Separator |
| 228 | measure_sha384(b"Exit Boot Services Invocation"), |
| 229 | measure_sha384(b"Exit Boot Services Returned with Success"), |
| 230 | ]) |
| 231 | } |
| 232 | |
| 233 | /// Measures the kernel command line by converting to UTF-16LE and hashing. |
| 234 | pub(crate) fn measure_cmdline(cmdline: &str) -> Vec<u8> { |
no test coverage detected