@@ -3,7 +3,7 @@ mod ak_certificate;
33mod nv_index;
44use 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} ;
77use base64:: { engine:: general_purpose:: URL_SAFE as BASE64_URL_SAFE , Engine as _} ;
88use num_bigint:: BigUint ;
99use openssl:: { error:: ErrorStack , pkey:: PKey } ;
@@ -42,12 +42,14 @@ struct TpmAttest {
4242
4343/// Generate a TDX attestation on Azure
4444pub 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