@@ -31,6 +31,7 @@ pub fn run_dcap_ra(
3131 target_enclave_key : Address ,
3232 pccs_url : & str ,
3333 certs_service_url : & str ,
34+ is_early_update : bool ,
3435) -> Result < ( ) , Error > {
3536 let current_time = Time :: now ( ) ;
3637 let result = dcap_ra (
@@ -39,6 +40,7 @@ pub fn run_dcap_ra(
3940 current_time,
4041 pccs_url,
4142 certs_service_url,
43+ is_early_update,
4244 ) ?;
4345
4446 key_manager
@@ -55,6 +57,7 @@ pub(crate) fn dcap_ra(
5557 current_time : Time ,
5658 pccs_url : & str ,
5759 certs_service_url : & str ,
60+ is_early_update : bool ,
5861) -> Result < DCAPRemoteAttestationResult , Error > {
5962 let ek_info = key_manager. load ( target_enclave_key) . map_err ( |e| {
6063 Error :: key_manager (
@@ -69,7 +72,7 @@ pub(crate) fn dcap_ra(
6972
7073 let quote = QuoteV3 :: from_bytes ( & raw_quote) . map_err ( Error :: dcap_quote_verifier) ?;
7174
72- let collateral = get_collateral ( pccs_url, certs_service_url, & quote) ?;
75+ let collateral = get_collateral ( pccs_url, certs_service_url, is_early_update , & quote) ?;
7376 let output = verify_quote_dcapv3 ( & quote, & collateral, current_time. as_unix_timestamp_secs ( ) )
7477 . map_err ( Error :: dcap_quote_verifier) ?;
7578 info ! (
@@ -131,6 +134,7 @@ fn rsgx_qe_get_quote(app_report: &sgx_report_t) -> Result<Vec<u8>, sgx_quote3_er
131134fn get_collateral (
132135 pccs_url : & str ,
133136 certs_service_url : & str ,
137+ is_early_update : bool ,
134138 quote : & QuoteV3 ,
135139) -> Result < IntelCollateral , Error > {
136140 let pccs_url = pccs_url. trim_end_matches ( '/' ) ;
@@ -149,6 +153,8 @@ fn get_collateral(
149153 ) ) ;
150154 }
151155
156+ let update_policy = if is_early_update { "early" } else { "standard" } ;
157+
152158 // get the pck certificate
153159 let pck_cert = & certchain[ 0 ] ;
154160 let pck_cert_issuer = & certchain[ 1 ] ;
@@ -157,13 +163,15 @@ fn get_collateral(
157163 let sgx_extensions = extract_sgx_extensions ( pck_cert) ;
158164 let ( tcbinfo_bytes, sgx_tcb_signing_der) = {
159165 let fmspc = hex:: encode_upper ( sgx_extensions. fmspc ) ;
160- let res = http_get ( format ! ( "{base_url}/tcb?fmspc={fmspc}" ) ) ?;
166+ let res = http_get ( format ! (
167+ "{base_url}/tcb?fmspc={fmspc}&update={update_policy}"
168+ ) ) ?;
161169 let issuer_chain =
162170 extract_raw_certs ( get_header ( & res, "TCB-Info-Issuer-Chain" ) ?. as_bytes ( ) ) ?;
163171 ( res. bytes ( ) ?. to_vec ( ) , issuer_chain[ 0 ] . clone ( ) )
164172 } ;
165173
166- let qeidentity_bytes = http_get ( format ! ( "{base_url}/qe/identity" ) ) ?
174+ let qeidentity_bytes = http_get ( format ! ( "{base_url}/qe/identity?update={update_policy} " ) ) ?
167175 . bytes ( ) ?
168176 . to_vec ( ) ;
169177 let sgx_intel_root_ca_crl_der = http_get ( format ! ( "{certs_service_url}/IntelSGXRootCA.der" ) ) ?
@@ -241,6 +249,7 @@ mod tests {
241249 let collateral = get_collateral (
242250 "https://api.trustedservices.intel.com/" ,
243251 "https://certificates.trustedservices.intel.com/" ,
252+ false ,
244253 & quote,
245254 )
246255 . unwrap ( ) ;
0 commit comments