Validate the TCB attributes
(report: &TdxVerifiedReport)
| 1158 | |
| 1159 | /// Validate the TCB attributes |
| 1160 | pub 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)] |
no test coverage detected