(self, request: TdxQuoteArgs)
| 516 | } |
| 517 | |
| 518 | async fn tdx_quote(self, request: TdxQuoteArgs) -> Result<TdxQuoteResponse> { |
| 519 | let hash_algorithm = if request.hash_algorithm.is_empty() { |
| 520 | DEFAULT_HASH_ALGORITHM |
| 521 | } else { |
| 522 | &request.hash_algorithm |
| 523 | }; |
| 524 | let prefix = if hash_algorithm == "raw" { |
| 525 | "".into() |
| 526 | } else { |
| 527 | QuoteContentType::AppData.tag().to_string() |
| 528 | }; |
| 529 | let content_type = if request.prefix.is_empty() { |
| 530 | QuoteContentType::AppData |
| 531 | } else { |
| 532 | QuoteContentType::Custom(&request.prefix) |
| 533 | }; |
| 534 | let report_data = |
| 535 | content_type.to_report_data_with_hash(&request.report_data, &request.hash_algorithm)?; |
| 536 | let response = self.state.quote_response(report_data)?; |
| 537 | Ok(TdxQuoteResponse { |
| 538 | quote: response.quote, |
| 539 | event_log: response.event_log, |
| 540 | hash_algorithm: hash_algorithm.to_string(), |
| 541 | prefix, |
| 542 | }) |
| 543 | } |
| 544 | |
| 545 | async fn raw_quote(self, request: RawQuoteArgs) -> Result<TdxQuoteResponse> { |
| 546 | self.tdx_quote(TdxQuoteArgs { |
no test coverage detected