Skip to content

Commit 38bd434

Browse files
author
valdok
committed
build fix
1 parent c3adfd8 commit 38bd434

File tree

1 file changed

+4
-29
lines changed

1 file changed

+4
-29
lines changed

cosmwasm/enclaves/execute/src/registration/attestation.rs

Lines changed: 4 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ use std::{
4646

4747
#[cfg(all(feature = "SGX_MODE_HW", feature = "production"))]
4848
use crate::registration::cert::verify_ra_cert;
49-
//#[cfg(all(feature = "SGX_MODE_HW", feature = "production"))]
50-
//use crate::registration::offchain::get_attestation_report_dcap;
49+
#[cfg(all(feature = "SGX_MODE_HW", feature = "production"))]
50+
use crate::registration::offchain::get_attestation_report_dcap;
5151

5252
#[cfg(feature = "SGX_MODE_HW")]
5353
use enclave_crypto::consts::SIGNING_METHOD;
@@ -132,40 +132,15 @@ pub fn create_attestation_certificate(
132132
Ok((key_der, cert_der))
133133
}
134134

135-
#[cfg(all(feature = "SGX_MODE_HW", feature = "production"))]
136-
pub fn validate_enclave_version_dcap(kp: &KeyPair) -> Result<(), sgx_status_t> {
137-
let (vec_quote, vec_coll) = get_quote_ecdsa_untested(kp)?;
138-
139-
// test self
140-
match verify_quote_ecdsa(&vec_quote, &vec_coll, 0) {
141-
Ok(r) => {
142-
trace!("Self quote verified ok");
143-
if r.1 != sgx_ql_qv_result_t::SGX_QL_QV_RESULT_OK {
144-
// TODO: strict policy wrt own quote verification
145-
trace!("WARNING: {}", r.1);
146-
}
147-
}
148-
Err(e) => {
149-
trace!("Self quote verification failed: {}", e);
150-
151-
write_to_untrusted(&vec_quote, ATTESTATION_DCAP_PATH.as_str())?;
152-
write_to_untrusted(&vec_coll, COLLATERAL_DCAP_PATH.as_str())?;
153-
154-
return Err(e);
155-
}
156-
};
157-
158-
Ok(())
159-
}
160-
161135
#[cfg(all(feature = "SGX_MODE_HW", feature = "production"))]
162136
pub fn validate_enclave_version(
163137
kp: &KeyPair,
164138
sign_type: sgx_quote_sign_type_t,
165139
api_key: &[u8],
166140
challenge: Option<&[u8]>,
167141
) -> Result<(), sgx_status_t> {
168-
if validate_enclave_version_dcap(kp).is_ok() {
142+
let res_dcap = unsafe { get_attestation_report_dcap(&kp) };
143+
if res_dcap.is_ok() {
169144
return Ok(());
170145
}
171146

0 commit comments

Comments
 (0)