(
boottime_mr: bool,
mr_key_provider: &[u8],
quote: &[u8],
runtime_events: &[RuntimeEvent],
)
| 747 | } |
| 748 | |
| 749 | fn decode_mr_tdx_from_quote( |
| 750 | boottime_mr: bool, |
| 751 | mr_key_provider: &[u8], |
| 752 | quote: &[u8], |
| 753 | runtime_events: &[RuntimeEvent], |
| 754 | ) -> Result<Mrs> { |
| 755 | let quote = Quote::parse(quote).context("Failed to parse quote")?; |
| 756 | let rtmr3 = |
| 757 | replay_runtime_events::<Sha384>(runtime_events, boottime_mr.then_some("boot-mr-done")); |
| 758 | let td_report = quote.report.as_td10().context("TDX report not found")?; |
| 759 | let mr_system = sha256([ |
| 760 | &td_report.mr_td[..], |
| 761 | &td_report.rt_mr0, |
| 762 | &td_report.rt_mr1, |
| 763 | &td_report.rt_mr2, |
| 764 | mr_key_provider, |
| 765 | ]); |
| 766 | let mr_aggregated = { |
| 767 | let mut hasher = sha2::Sha256::new(); |
| 768 | for d in [ |
| 769 | &td_report.mr_td, |
| 770 | &td_report.rt_mr0, |
| 771 | &td_report.rt_mr1, |
| 772 | &td_report.rt_mr2, |
| 773 | &rtmr3, |
| 774 | ] { |
| 775 | hasher.update(d); |
| 776 | } |
| 777 | if td_report.mr_config_id != [0u8; 48] |
| 778 | || td_report.mr_owner != [0u8; 48] |
| 779 | || td_report.mr_owner_config != [0u8; 48] |
| 780 | { |
| 781 | hasher.update(td_report.mr_config_id); |
| 782 | hasher.update(td_report.mr_owner); |
| 783 | hasher.update(td_report.mr_owner_config); |
| 784 | } |
| 785 | hasher.finalize().into() |
| 786 | }; |
| 787 | Ok(Mrs { |
| 788 | mr_system, |
| 789 | mr_aggregated, |
| 790 | }) |
| 791 | } |
| 792 | |
| 793 | async fn verify_tdx_quote_with_events( |
| 794 | pccs_url: Option<&str>, |
no test coverage detected