Skip to content

Commit

Permalink
Iteration #1
Browse files Browse the repository at this point in the history
  • Loading branch information
toml01 committed Aug 31, 2020
1 parent ba8019f commit 90433d8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
6 changes: 3 additions & 3 deletions cosmwasm/packages/wasmi-runtime/src/exports.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ pub unsafe extern "C" fn ecall_init(
err: EnclaveError::OutOfMemory,
}
} else {
error!("Call ecall_init panic'd unexpectedly!");
error!("Call ecall_init panicked unexpectedly!");
InitResult::Failure {
err: EnclaveError::Panic,
}
Expand Down Expand Up @@ -225,7 +225,7 @@ pub unsafe extern "C" fn ecall_handle(
err: EnclaveError::OutOfMemory,
}
} else {
error!("Call ecall_handle panic'd unexpectedly!");
error!("Call ecall_handle panicked unexpectedly!");
HandleResult::Failure {
err: EnclaveError::Panic,
}
Expand Down Expand Up @@ -287,7 +287,7 @@ pub unsafe extern "C" fn ecall_query(
err: EnclaveError::OutOfMemory,
}
} else {
error!("Call ecall_query panic'd unexpectedly!");
error!("Call ecall_query panicked unexpectedly!");
QueryResult::Failure {
err: EnclaveError::Panic,
}
Expand Down
7 changes: 3 additions & 4 deletions cosmwasm/packages/wasmi-runtime/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ impl<T, S> UnwrapOrSgxErrorUnexpected for Result<T, S> {

pub fn validate_mut_ptr(ptr: *mut u8, ptr_len: usize) -> SgxResult<()> {
if rsgx_raw_is_outside_enclave(ptr, ptr_len) {
error!("Tried to access memory outside enclave -- rsgx_slice_is_outside_enclave");
warn!("Tried to access memory outside enclave -- rsgx_slice_is_outside_enclave");
return Err(sgx_status_t::SGX_ERROR_UNEXPECTED);
}
rsgx_sfence();
Expand All @@ -46,7 +46,7 @@ pub fn validate_mut_ptr(ptr: *mut u8, ptr_len: usize) -> SgxResult<()> {

pub fn validate_const_ptr(ptr: *const u8, ptr_len: usize) -> SgxResult<()> {
if ptr.is_null() || ptr_len == 0 {
error!("Tried to access an empty pointer - ptr.is_null()");
warn!("Tried to access an empty pointer - ptr.is_null()");
return Err(sgx_status_t::SGX_ERROR_UNEXPECTED);
}
rsgx_lfence();
Expand All @@ -55,7 +55,7 @@ pub fn validate_const_ptr(ptr: *const u8, ptr_len: usize) -> SgxResult<()> {

pub fn validate_mut_slice(mut_slice: &mut [u8]) -> SgxResult<()> {
if rsgx_slice_is_outside_enclave(mut_slice) {
error!("Tried to access memory outside enclave -- rsgx_slice_is_outside_enclave");
warn!("Tried to access memory outside enclave -- rsgx_slice_is_outside_enclave");
return Err(sgx_status_t::SGX_ERROR_UNEXPECTED);
}
rsgx_sfence();
Expand All @@ -80,7 +80,6 @@ pub fn attest_from_key(
}
Ok(res) => res,
};
// info!("private key {:?}, cert: {:?}", private_key_der, cert);

if let Err(status) = write_to_untrusted(cert.as_slice(), save_path) {
return Err(status);
Expand Down

0 comments on commit 90433d8

Please sign in to comment.