@@ -46,8 +46,8 @@ use std::{
46
46
47
47
#[ cfg( all( feature = "SGX_MODE_HW" , feature = "production" ) ) ]
48
48
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;
51
51
52
52
#[ cfg( feature = "SGX_MODE_HW" ) ]
53
53
use enclave_crypto:: consts:: SIGNING_METHOD ;
@@ -132,40 +132,15 @@ pub fn create_attestation_certificate(
132
132
Ok ( ( key_der, cert_der) )
133
133
}
134
134
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
-
161
135
#[ cfg( all( feature = "SGX_MODE_HW" , feature = "production" ) ) ]
162
136
pub fn validate_enclave_version (
163
137
kp : & KeyPair ,
164
138
sign_type : sgx_quote_sign_type_t ,
165
139
api_key : & [ u8 ] ,
166
140
challenge : Option < & [ u8 ] > ,
167
141
) -> 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 ( ) {
169
144
return Ok ( ( ) ) ;
170
145
}
171
146
0 commit comments