diff --git a/src/config.rs b/src/config.rs index 015de9a..a18a202 100644 --- a/src/config.rs +++ b/src/config.rs @@ -1,7 +1,7 @@ use crate::{RaTlsConfigBuilder, RaTlsError}; #[cfg(feature = "occlum")] -use crate::quote::Quote; +use crate::quote::{Quote, STATIC_QUOTE}; use rustls::{ClientConfig, ServerConfig}; @@ -56,6 +56,11 @@ impl InstanceMeasurement { } } + + fn generate_static_empty_quote() -> Result<&'static Quote, RaTlsError> { + Ok(STATIC_QUOTE.as_ref().map_err(|e| e.clone())?) + } + pub(crate) fn check_quote_measurements(&self, quote: &Quote) -> bool { let mut result = false; if let Some(mrsigners) = &self.mrsigners { diff --git a/src/error.rs b/src/error.rs index 68d790d..6ef74df 100644 --- a/src/error.rs +++ b/src/error.rs @@ -1,6 +1,6 @@ use std::{error::Error, fmt::Display}; -#[derive(Debug)] +#[derive(Debug, Clone)] pub enum RaTlsError { CertificateBuildError(String), QuoteError(String), diff --git a/src/quote.rs b/src/quote.rs index 6ed637e..dda9adb 100644 --- a/src/quote.rs +++ b/src/quote.rs @@ -143,6 +143,18 @@ lazy_static! { }; } +// lazy_static! { +// pub static ref STATIC_QUOTE: once_cell::sync::OnceCell = +// OnceCell::with_value(Quote::from_report_data([0u8; 64]).unwrap()); +// } +// unsafe impl Send for Quote {} + +lazy_static! { + pub static ref STATIC_QUOTE: Result = Quote::from_report_data([0u8; 64]); +} + +unsafe impl Sync for Quote {} + pub struct IoctlClient { fd: HandleType, quote_size: Option,