diff --git a/common/rust/cctrusted_base/src/api_data.rs b/common/rust/cctrusted_base/src/api_data.rs index 37f5e36d..bc301856 100644 --- a/common/rust/cctrusted_base/src/api_data.rs +++ b/common/rust/cctrusted_base/src/api_data.rs @@ -12,9 +12,13 @@ use crate::tcg::TcgDigest; pub struct ExtraArgs {} // return of API get_cc_report() +#[derive(Default)] pub struct CcReport { pub cc_report: Vec, pub cc_type: TeeType, + pub cc_aux_blob: Option>, + pub cc_report_generation: Option, + pub cc_provider: Option, } /*** diff --git a/common/rust/cctrusted_base/src/cc_type.rs b/common/rust/cctrusted_base/src/cc_type.rs index 5ba8f237..0eb943c7 100644 --- a/common/rust/cctrusted_base/src/cc_type.rs +++ b/common/rust/cctrusted_base/src/cc_type.rs @@ -1,26 +1,26 @@ -use hashbrown::HashMap; +use core::convert::From; // supported TEE types -#[derive(Clone, Eq, Hash, PartialEq, Debug)] +#[derive(Clone, Eq, Hash, PartialEq, Debug, Default)] pub enum TeeType { PLAIN = -1, TPM = 0, + #[default] TDX = 1, SEV = 2, CCA = 3, } -// TEE type to type name string mapping -lazy_static! { - pub static ref TEE_NAME_MAP: HashMap = { - let mut map: HashMap = HashMap::new(); - map.insert(TeeType::PLAIN, "PLAIN".to_string()); - map.insert(TeeType::TDX, "TDX".to_string()); - map.insert(TeeType::SEV, "SEV".to_string()); - map.insert(TeeType::CCA, "CCA".to_string()); - map.insert(TeeType::TPM, "TPM".to_string()); - map - }; +impl From for String { + fn from(t: TeeType) -> String { + match t { + TeeType::PLAIN => "PLAIN".to_string(), + TeeType::TPM => "TPM".to_string(), + TeeType::TDX => "TDX".to_string(), + TeeType::SEV => "SEV".to_string(), + TeeType::CCA => "CCA".to_string(), + } + } } // public known device node path @@ -29,10 +29,10 @@ pub const TEE_TDX_1_0_PATH: &str = "/dev/tdx-guest"; pub const TEE_TDX_1_5_PATH: &str = "/dev/tdx_guest"; pub const TEE_SEV_PATH: &str = "/dev/sev-guest"; pub const TEE_CCA_PATH: &str = ""; +pub const TSM_PREFIX: &str = "/sys/kernel/config/tsm/report"; // holds the TEE type info #[derive(Clone)] pub struct CcType { pub tee_type: TeeType, - pub tee_type_str: String, }