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

Function validate_tcb

dstack-attest/src/attestation.rs:1160–1189  ·  view source on GitHub ↗

Validate the TCB attributes

(report: &TdxVerifiedReport)

Source from the content-addressed store, hash-verified

1158
1159/// Validate the TCB attributes
1160pub fn validate_tcb(report: &TdxVerifiedReport) -> Result<()> {
1161 fn validate_td10(report: &TDReport10) -> Result<()> {
1162 let is_debug = report.td_attributes[0] & 0x01 != 0;
1163 if is_debug {
1164 bail!("Debug mode is not allowed");
1165 }
1166 if report.mr_signer_seam != [0u8; 48] {
1167 bail!("Invalid mr signer seam");
1168 }
1169 Ok(())
1170 }
1171 fn validate_td15(report: &TDReport15) -> Result<()> {
1172 if report.mr_service_td != [0u8; 48] {
1173 bail!("Invalid mr service td");
1174 }
1175 validate_td10(&report.base)
1176 }
1177 fn validate_sgx(report: &EnclaveReport) -> Result<()> {
1178 let is_debug = report.attributes[0] & 0x02 != 0;
1179 if is_debug {
1180 bail!("Debug mode is not allowed");
1181 }
1182 Ok(())
1183 }
1184 match &report.report {
1185 Report::TD15(report) => validate_td15(report),
1186 Report::TD10(report) => validate_td10(report),
1187 Report::SgxEnclave(report) => validate_sgx(report),
1188 }
1189}
1190
1191/// Information about the app extracted from event log
1192#[derive(Debug, Clone, Serialize, Deserialize)]

Callers 3

verify_tdxMethod · 0.85
get_sealing_keyMethod · 0.85

Calls 3

validate_td15Function · 0.85
validate_td10Function · 0.85
validate_sgxFunction · 0.85

Tested by

no test coverage detected