Skip to content

Commit 396a75e

Browse files
committed
Merge branch 'peg/azure-attestation-fix' into peg/fixes-together
* peg/azure-attestation-fix: Azure attestation tdx-quote must be based on td_report with input data
2 parents 5610123 + bf78f8a commit 396a75e

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

src/attestation/azure/mod.rs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ mod ak_certificate;
33
mod nv_index;
44
use ak_certificate::{read_ak_certificate_from_tpm, verify_ak_cert_with_azure_roots};
55

6-
use az_tdx_vtpm::{hcl, imds, report, vtpm};
6+
use az_tdx_vtpm::{hcl, imds, vtpm};
77
use base64::{engine::general_purpose::URL_SAFE as BASE64_URL_SAFE, Engine as _};
88
use num_bigint::BigUint;
99
use openssl::{error::ErrorStack, pkey::PKey};
@@ -42,12 +42,14 @@ struct TpmAttest {
4242

4343
/// Generate a TDX attestation on Azure
4444
pub async fn create_azure_attestation(input_data: [u8; 64]) -> Result<Vec<u8>, MaaError> {
45-
let td_report = report::get_report()?;
45+
let hcl_report_bytes = vtpm::get_report_with_report_data(&input_data)?;
4646

47-
// This makes a request to Azure Instance metadata service and gives us a binary response
48-
let td_quote_bytes = imds::get_td_quote(&td_report)?;
47+
let hcl = hcl::HclReport::new(hcl_report_bytes.clone())?;
4948

50-
let hcl_report_bytes = vtpm::get_report_with_report_data(&input_data)?;
49+
let td_report_from_hcl = hcl.try_into()?;
50+
51+
// This makes a request to Azure Instance metadata service and gives us a binary response
52+
let td_quote_bytes = imds::get_td_quote(&td_report_from_hcl)?;
5153

5254
let ak_certificate_der = read_ak_certificate_from_tpm()?;
5355

0 commit comments

Comments
 (0)