Skip to content

Commit

Permalink
tee-info-hash-tool: update the metadata check when type is TD_INFO
Browse files Browse the repository at this point in the history
Signed-off-by: Lu, Xiaoyu1 <[email protected]>
  • Loading branch information
xiaoyuxlu authored and jyao1 committed Dec 13, 2024
1 parent 51f8831 commit b4ee544
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion td-shim-tools/src/tee_info_hash.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}

Expand Down

0 comments on commit b4ee544

Please sign in to comment.