Skip to content

Commit 4f182ec

Browse files
committed
td-shim,td-shim-interface: add no-tdx-signature-check feature
Allow skipping signature check feature for TPA TD Signed-off-by: Stanislaw Grams <[email protected]>
1 parent 1ad3ca4 commit 4f182ec

File tree

3 files changed

+12
-3
lines changed

3 files changed

+12
-3
lines changed

td-shim-interface/Cargo.toml

+3
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,6 @@ scroll = { version = "0.10", default-features = false, features = ["derive"] }
1616
zerocopy = { version = "0.7.31", features = ["derive"] }
1717

1818
log = "0.4.13"
19+
20+
[features]
21+
no-tdx-signature-check = []

td-shim-interface/src/metadata.rs

+8-3
Original file line numberDiff line numberDiff line change
@@ -98,14 +98,19 @@ impl TdxMetadataDescriptor {
9898
}
9999

100100
pub fn is_valid(&self) -> bool {
101-
let len = self.length;
101+
#[cfg(not(feature = "no-tdx-signature-check"))]
102+
if self.signature != TDX_METADATA_SIGNATURE
103+
return false;
102104

103-
!(self.signature != TDX_METADATA_SIGNATURE
104-
|| self.version != 1
105+
let len = self.length;
106+
if self.version != 1
105107
|| self.number_of_section_entry == 0
106108
|| len < 16
107109
|| (len - 16) % 32 != 0
108110
|| (len - 16) / 32 != self.number_of_section_entry)
111+
return false;
112+
113+
true
109114
}
110115

111116
pub fn as_bytes(&self) -> &[u8] {

td-shim/Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ tdx = ["tdx-tdcall", "td-exception/tdx", "td-logger/tdx", "x86"]
5151
lazy-accept = ["tdx"]
5252
ring-hash = ["cc-measurement/ring"]
5353
sha2-hash = ["cc-measurement/sha2"]
54+
no-tdx-signature-check = ["td-shim-interface/no-tdx-signature-check"]
5455
main = [
5556
"log",
5657
"td-loader",

0 commit comments

Comments
 (0)