Skip to content

Commit

Permalink
err handling improved
Browse files Browse the repository at this point in the history
  • Loading branch information
valdok committed Apr 8, 2024
1 parent 2b5645e commit a62ad88
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 5 deletions.
17 changes: 14 additions & 3 deletions cosmwasm/packages/sgx-vm/src/attestation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -412,18 +412,26 @@ pub extern "C" fn ocall_verify_quote_ecdsa(
}

unsafe {
sgx_qv_set_enclave_load_policy(sgx_ql_request_policy_t::SGX_QL_PERSISTENT);
sgx_qv_get_quote_supplemental_data_size(p_supp_data_size);
let res0 = sgx_qv_set_enclave_load_policy(sgx_ql_request_policy_t::SGX_QL_PERSISTENT);
if sgx_quote3_error_t::SGX_QL_SUCCESS != res0 {
warn!("sgx_qv_set_enclave_load_policy: {}", res0);
}

let res1 = sgx_qv_get_quote_supplemental_data_size(p_supp_data_size);
if sgx_quote3_error_t::SGX_QL_SUCCESS != res1 {
warn!("sgx_qv_get_quote_supplemental_data_size: {}", res1);
}

if *p_supp_data_size > n_supp_data {
warn!("supp data buf required: {}", *p_supp_data_size);
return sgx_status_t::SGX_ERROR_UNEXPECTED;
}

(*p_qve_report_info).app_enclave_target_info = *p_target_info;

let my_col = sgx_ql_qve_collateral_deserialize(p_col, n_col);

sgx_qv_verify_quote(
let res2 = sgx_qv_verify_quote(
p_quote,
n_quote,
&my_col,
Expand All @@ -434,6 +442,9 @@ pub extern "C" fn ocall_verify_quote_ecdsa(
*p_supp_data_size,
p_supp_data,
);
if sgx_quote3_error_t::SGX_QL_SUCCESS != res2 {
warn!("sgx_qv_verify_quote: {}", res2);
}

*p_time_s = time_use_s;
};
Expand Down
8 changes: 6 additions & 2 deletions go-cosmwasm/api/lib.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ package api
import "C"

import (
"errors"
"fmt"
"runtime"
"syscall"
Expand Down Expand Up @@ -94,9 +95,12 @@ func LoadSeedToEnclave(masterKey []byte, seed []byte, apiKey []byte) (bool, erro
}

func MigrateSealing() (bool, error) {
_, err := C.migrate_sealing()
ret, err := C.migrate_sealing()
if err != nil {
return false, nil
return false, err
}
if !ret {
return false, errors.New("Sealing migration failed")

Check failure on line 103 in go-cosmwasm/api/lib.go

View workflow job for this annotation

GitHub Actions / lint

ST1005: error strings should not be capitalized (stylecheck)
}
return true, nil
}
Expand Down

0 comments on commit a62ad88

Please sign in to comment.