diff --git a/modules/lcp-client/src/client_def.rs b/modules/lcp-client/src/client_def.rs index a632ea40..c15c5546 100644 --- a/modules/lcp-client/src/client_def.rs +++ b/modules/lcp-client/src/client_def.rs @@ -104,7 +104,7 @@ impl LCPClient { Ok(()) } - // verify_client_message verifies a client message + /// update_client verifies a client message and updates the state of the client pub fn update_client( &self, ctx: &mut dyn HostClientKeeper, diff --git a/modules/remote-attestation/src/ias_utils.rs b/modules/remote-attestation/src/ias_utils.rs index 3b335145..23bec347 100644 --- a/modules/remote-attestation/src/ias_utils.rs +++ b/modules/remote-attestation/src/ias_utils.rs @@ -87,7 +87,7 @@ pub(crate) fn get_quote( info!("quote size = {}", quote_size); let mut qe_report = sgx_report_t::default(); - let quote = [0u8; 2048]; + let quote: Vec = vec![0; quote_size as usize]; let p_quote = quote.as_ptr(); let ret = unsafe { sgx_get_quote( @@ -105,7 +105,7 @@ pub(crate) fn get_quote( if ret != sgx_status_t::SGX_SUCCESS { return Err(Error::sgx_error(ret, "failed to sgx_get_quote".into())); } - (quote[..quote_size as usize].to_vec(), qe_report) + (quote, qe_report) }; // Check qe_report to defend against replay attack @@ -415,6 +415,7 @@ pub(crate) fn decode_spid(spid_str: &str) -> Result { } }; let mut spid = sgx_spid_t::default(); - spid.id.copy_from_slice(&decoded_vec[..16]); + // the length of `decoded_vec` is 16 because each byte is represented by 2 characters + spid.id.copy_from_slice(&decoded_vec); Ok(spid) }