Return a new attestation with the report_data patched in both platform quote and stack.
(self, report_data: [u8; 64])
| 192 | |
| 193 | /// Return a new attestation with the report_data patched in both platform quote and stack. |
| 194 | pub fn with_report_data(self, report_data: [u8; 64]) -> Self { |
| 195 | use crate::attestation::TDX_QUOTE_REPORT_DATA_RANGE; |
| 196 | |
| 197 | let platform = match self.platform { |
| 198 | PlatformEvidence::Tdx { |
| 199 | mut quote, |
| 200 | event_log, |
| 201 | } => { |
| 202 | if quote.len() >= TDX_QUOTE_REPORT_DATA_RANGE.end { |
| 203 | quote[TDX_QUOTE_REPORT_DATA_RANGE].copy_from_slice(&report_data); |
| 204 | } |
| 205 | PlatformEvidence::Tdx { quote, event_log } |
| 206 | } |
| 207 | other => other, |
| 208 | }; |
| 209 | let stack = match self.stack { |
| 210 | StackEvidence::Dstack { |
| 211 | runtime_events, |
| 212 | config, |
| 213 | .. |
| 214 | } => StackEvidence::Dstack { |
| 215 | report_data: report_data.to_vec(), |
| 216 | runtime_events, |
| 217 | config, |
| 218 | }, |
| 219 | StackEvidence::DstackPod { |
| 220 | runtime_events, |
| 221 | config, |
| 222 | report_data_payload, |
| 223 | .. |
| 224 | } => StackEvidence::DstackPod { |
| 225 | report_data: report_data.to_vec(), |
| 226 | runtime_events, |
| 227 | config, |
| 228 | report_data_payload, |
| 229 | }, |
| 230 | }; |
| 231 | Self { |
| 232 | version: self.version, |
| 233 | platform, |
| 234 | stack, |
| 235 | } |
| 236 | } |
| 237 | } |
| 238 | |
| 239 | #[cfg(test)] |