From 9446294698a1f2a525914f89b08a6c12ec2db626 Mon Sep 17 00:00:00 2001 From: "Lu, Xiaoyu1" Date: Fri, 13 Dec 2024 02:49:24 -0500 Subject: [PATCH] tee-info-hash-tool: update the metadata check when type is TD_INFO Signed-off-by: Lu, Xiaoyu1 --- td-shim-tools/src/tee_info_hash.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/td-shim-tools/src/tee_info_hash.rs b/td-shim-tools/src/tee_info_hash.rs index 3cef9e81..851d6db4 100644 --- a/td-shim-tools/src/tee_info_hash.rs +++ b/td-shim-tools/src/tee_info_hash.rs @@ -290,7 +290,11 @@ impl TdInfoStruct { panic!("Memory address must be 4K aligned!\n"); } - if sec.memory_data_size < sec.raw_data_size as u64 { + // MemoryAddress and MemoryDataSize shall be zero when the section type is TD_INFO + if (sec.r#type != TDX_METADATA_SECTION_TYPE_TD_INFO) + && (sec.memory_address != 0 || sec.memory_data_size != 0) + && sec.memory_data_size < sec.raw_data_size as u64 + { panic!("Memory data size must exceed or equal the raw data size!\n"); }