From c19587285c58afc5e3e43242dbbe8ad47ae23cf1 Mon Sep 17 00:00:00 2001 From: Jun Kimura Date: Tue, 19 Nov 2024 18:10:14 +0900 Subject: [PATCH] fix to use `quote_size` instead of hardcoded quote size Signed-off-by: Jun Kimura --- modules/remote-attestation/src/ias_utils.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/remote-attestation/src/ias_utils.rs b/modules/remote-attestation/src/ias_utils.rs index 3b335145..bd3346e2 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