From ed595c4360ceb269bca12a0ae8f5193d691f1c16 Mon Sep 17 00:00:00 2001 From: valdok Date: Mon, 25 Mar 2024 12:24:29 +0000 Subject: [PATCH] build fix (SW mode) --- .../execute/src/registration/attestation.rs | 19 +++++++++++++++++++ .../enclaves/execute/src/registration/cert.rs | 3 --- .../execute/src/registration/onchain.rs | 1 - 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/cosmwasm/enclaves/execute/src/registration/attestation.rs b/cosmwasm/enclaves/execute/src/registration/attestation.rs index 6b3b9380c..70b435c84 100644 --- a/cosmwasm/enclaves/execute/src/registration/attestation.rs +++ b/cosmwasm/enclaves/execute/src/registration/attestation.rs @@ -287,11 +287,25 @@ pub fn in_grace_period(timestamp: u64) -> bool { timestamp < 1692626400_u64 } +#[cfg(not(feature = "SGX_MODE_HW"))] +pub fn get_mr_enclave() -> [u8; 32] { + let mut ret: [u8; 32] = [0; 32]; + ret +} + #[cfg(feature = "SGX_MODE_HW")] pub fn get_mr_enclave() -> [u8; 32] { rsgx_self_report().body.mr_enclave.m } +#[cfg(not(feature = "SGX_MODE_HW"))] +pub fn verify_quote_ecdsa( + vec_quote: &Vec, + vec_coll: &Vec, + time_s: i64, +) -> Result<(sgx_report_body_t, sgx_ql_qv_result_t), sgx_status_t> { + Err(sgx_status_t::SGX_ERROR_NO_DEVICE) +} #[cfg(feature = "SGX_MODE_HW")] pub fn verify_quote_ecdsa( @@ -403,6 +417,11 @@ fn test_sgx_call_res( return Ok(sgx_status_t::SGX_SUCCESS); } +#[cfg(not(feature = "SGX_MODE_HW"))] +pub fn get_quote_ecdsa(pub_k: &[u8; 32]) -> Result<(Vec, Vec), sgx_status_t> { + Err(sgx_status_t::SGX_ERROR_NO_DEVICE) +} + #[cfg(feature = "SGX_MODE_HW")] pub fn get_quote_ecdsa(pub_k: &[u8; 32]) -> Result<(Vec, Vec), sgx_status_t> { let mut qe_target_info = sgx_target_info_t::default(); diff --git a/cosmwasm/enclaves/execute/src/registration/cert.rs b/cosmwasm/enclaves/execute/src/registration/cert.rs index e2ee6d2b6..4c8b5a9c3 100644 --- a/cosmwasm/enclaves/execute/src/registration/cert.rs +++ b/cosmwasm/enclaves/execute/src/registration/cert.rs @@ -3,7 +3,6 @@ use bit_vec::BitVec; use chrono::Utc as TzUtc; use chrono::{Duration, TimeZone}; -#[cfg(feature = "SGX_MODE_HW")] use log::*; use num_bigint::BigUint; use sgx_tcrypto::SgxEccHandle; @@ -18,13 +17,11 @@ use std::time::{SystemTime, UNIX_EPOCH}; use yasna::models::ObjectIdentifier; use enclave_crypto::consts::{SigningMethod, CERTEXPIRYDAYS}; -#[cfg(feature = "SGX_MODE_HW")] use enclave_crypto::consts::{MRSIGNER, SIGNING_METHOD}; use enclave_ffi_types::NodeAuthResult; use crate::registration::report::AdvisoryIDs; -#[cfg(feature = "SGX_MODE_HW")] use super::attestation::get_mr_enclave; #[cfg(feature = "SGX_MODE_HW")] use super::report::{AttestationReport, SgxQuoteStatus}; diff --git a/cosmwasm/enclaves/execute/src/registration/onchain.rs b/cosmwasm/enclaves/execute/src/registration/onchain.rs index 5e659607e..252ef6a99 100644 --- a/cosmwasm/enclaves/execute/src/registration/onchain.rs +++ b/cosmwasm/enclaves/execute/src/registration/onchain.rs @@ -19,7 +19,6 @@ use enclave_utils::{ use sgx_types::sgx_ql_qv_result_t; -#[cfg(feature = "SGX_MODE_HW")] use enclave_crypto::consts::SigningMethod; use super::cert::verify_ra_cert;