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

Function rtmr1_log

dstack-mr/src/kernel.rs:215–231  ·  view source on GitHub ↗

Measures a QEMU-patched TDX kernel image.

(
    kernel_data: &[u8],
    initrd_size: u32,
    mem_size: u64,
    acpi_data_size: u32,
)

Source from the content-addressed store, hash-verified

213
214/// Measures a QEMU-patched TDX kernel image.
215pub(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.
234pub(crate) fn measure_cmdline(cmdline: &str) -> Vec<u8> {

Callers 1

measure_with_logsMethod · 0.85

Calls 2

patch_kernelFunction · 0.85
authenticode_sha384_hashFunction · 0.85

Tested by

no test coverage detected