Skip to content

Commit

Permalink
build fix (SW mode)
Browse files Browse the repository at this point in the history
  • Loading branch information
valdok committed Mar 25, 2024
1 parent 9386fa1 commit ed595c4
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 4 deletions.
19 changes: 19 additions & 0 deletions cosmwasm/enclaves/execute/src/registration/attestation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<u8>,
vec_coll: &Vec<u8>,
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(
Expand Down Expand Up @@ -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<u8>, Vec<u8>), 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<u8>, Vec<u8>), sgx_status_t> {
let mut qe_target_info = sgx_target_info_t::default();
Expand Down
3 changes: 0 additions & 3 deletions cosmwasm/enclaves/execute/src/registration/cert.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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};
Expand Down
1 change: 0 additions & 1 deletion cosmwasm/enclaves/execute/src/registration/onchain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit ed595c4

Please sign in to comment.