File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -102,7 +102,10 @@ impl CertRequestClient {
102102 let pubkey = key. public_key_der ( ) ;
103103 let report_data = QuoteContentType :: RaTlsCert . to_report_data ( & pubkey) ;
104104 let attestation = match attestation_override {
105- Some ( attestation) => attestation,
105+ Some ( mut attestation) => {
106+ attestation. set_report_data ( report_data) ;
107+ attestation
108+ }
106109 None => ra_rpc:: Attestation :: quote ( & report_data)
107110 . context ( "Failed to get quote for cert pubkey" ) ?
108111 . into_versioned ( ) ,
Original file line number Diff line number Diff line change @@ -267,6 +267,19 @@ impl VersionedAttestation {
267267 }
268268 }
269269
270+ /// Set the report_data field in the attestation and in the raw TDX quote bytes (offset 568..632).
271+ /// This is used by the simulator to patch a canned attestation with the correct report_data
272+ /// that binds to the actual TLS public key.
273+ pub fn set_report_data ( & mut self , report_data : [ u8 ; 64 ] ) {
274+ let VersionedAttestation :: V0 { attestation } = self ;
275+ attestation. report_data = report_data;
276+ if let Some ( tdx_quote) = attestation. tdx_quote_mut ( ) {
277+ if tdx_quote. quote . len ( ) >= 632 {
278+ tdx_quote. quote [ 568 ..632 ] . copy_from_slice ( & report_data) ;
279+ }
280+ }
281+ }
282+
270283 /// Strip data for certificate embedding (e.g. keep RTMR3 event logs only).
271284 pub fn into_stripped ( mut self ) -> Self {
272285 let VersionedAttestation :: V0 { attestation } = & mut self ;
You can’t perform that action at this time.
0 commit comments