From 7c193877f209703ed542e79149acc172ed0f8dbc Mon Sep 17 00:00:00 2001 From: Valentyn Faychuk Date: Sun, 20 Oct 2024 02:56:13 +0300 Subject: [PATCH] broken compilation --- Cargo.toml | 5 ++++- build.rs | 12 ++++++++---- examples/sealing.rs | 16 ++++++++-------- src/config.rs | 4 ++-- 4 files changed, 22 insertions(+), 15 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 8a24426..7f25006 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -31,7 +31,7 @@ lazy_static = "1.5" #sgx_tse = { version = "1.1", features = ["capi"] } #sgx_tse = "1.1" #sgx_types = "1.1" -sgx_tseal = "1.1" +#sgx_tseal = "1.1" [dependencies.tonic] version = "0.12" @@ -96,3 +96,6 @@ required-features = ["tonic"] [[example]] name = "mratls_grpcs_client" required-features = ["tonic"] + +[[example]] +name = "sealing" diff --git a/build.rs b/build.rs index 3a075aa..5cba388 100644 --- a/build.rs +++ b/build.rs @@ -10,12 +10,16 @@ fn main() { }; // Doesn't use standard C library, safe to compile with both musl and glibc - println!("cargo:rustc-link-search=crate=/opt/intel/sgxsdk/lib64"); - println!("cargo:rustc-link-search=crate={}", dcap_lib_path); + //println!("cargo:rustc-link-search=/opt/intel/sgxsdk/lib64"); + //println!("cargo:rustc-link-lib=sgx_tservice"); + //println!("cargo:rustc-link-lib=sgx_tcrypto"); + //println!("cargo:rustc-link-lib=sgx_trts"); + //println!("cargo:rustc-link-lib=sgx_pthread"); + //println!("cargo:rustc-link-lib=sgx_tstdc"); - // Cargo will look for `libocclum_dcap.a` and `libsgx_tservice.a` + // Cargo will look for `libocclum_dcap.a` + println!("cargo:rustc-link-search={}", dcap_lib_path); println!("cargo:rustc-link-lib=static:+whole-archive=occlum_dcap"); - println!("cargo:rustc-link-lib=static:+whole-archive=sgx_tservice"); } #[cfg(feature = "tonic")] diff --git a/examples/sealing.rs b/examples/sealing.rs index c659b5d..d140375 100644 --- a/examples/sealing.rs +++ b/examples/sealing.rs @@ -1,12 +1,12 @@ -use sgx_tseal::SgxSealedData; +//use sgx_tseal::SgxSealedData; fn main() { println!("Example of sealing"); - let text = "sealed text"; - let additional_text = "additional"; - let sealed_data = - SgxSealedData::<[u8]>::seal_data(additional_text.as_bytes(), text.as_bytes()).unwrap(); - let unsealed_data = SgxSealedData::unseal_data(&sealed_data).unwrap(); - let text: &str = unsealed_data.get_decrypt_text(); - println!("Unsealed text: {}", text); + //let text = "sealed text"; + //let additional_text = "additional"; + //let sealed_data = + // SgxSealedData::<[u8]>::seal_data(additional_text.as_bytes(), text.as_bytes()).unwrap(); + //let unsealed_data = SgxSealedData::<[u8]>::unseal_data(&sealed_data).unwrap(); + //let text: &str = &String::from_utf8_lossy(unsealed_data.get_decrypt_txt()); + //println!("Unsealed text: {}", text); } diff --git a/src/config.rs b/src/config.rs index 9be8169..e1cc8dc 100644 --- a/src/config.rs +++ b/src/config.rs @@ -60,7 +60,7 @@ impl InstanceMeasurement { let quote = Self::generate_static_empty_quote()?; let mrsigner_from_quote = quote.mrsigner().into(); - if let Some(mrsigners) = self.mrsigners { + if let Some(ref mrsigners) = self.mrsigners { if mrsigners.contains(&mrsigner_from_quote) { // already contains the mrsigner Ok(self) @@ -81,7 +81,7 @@ impl InstanceMeasurement { let quote = Self::generate_static_empty_quote()?; let mrenclave_from_quote = quote.mrenclave().into(); - if let Some(mrenclaves) = self.mrenclaves { + if let Some(ref mrenclaves) = self.mrenclaves { if mrenclaves.contains(&mrenclave_from_quote) { // already contains the mrenclave Ok(self)