You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@teaclave.apache.org by GitBox <gi...@apache.org> on 2020/01/15 06:44:48 UTC

[GitHub] [incubator-teaclave-sgx-sdk] yangji12138 commented on issue #195: Get SGX_ERROR_INVALID_PARAMETER when Calling sgx_get_quote()

yangji12138 commented on issue #195: Get SGX_ERROR_INVALID_PARAMETER when Calling sgx_get_quote()
URL: https://github.com/apache/incubator-teaclave-sgx-sdk/issues/195#issuecomment-574520277
 
 
   Thanks for your help. According to the official document, I implement get_quote_func() just in the untrusted app. I try many different ways to initialize the paramter, but none of them work.. 
   
   Following the sample code provided by ue-ra, I wrote a version. But it has the same problem:
   ```
           // Init Enclave parameter
           let quote_type = sgx_quote_sign_type_t::SGX_LINKABLE_SIGNATURE;
           let spid = sgx_spid_t::default();
           let p_spid = &spid as *const sgx_spid_t;
   
           // Optional Output: qe_report could be null
           let mut qe_report = sgx_report_t::default();
   
           const RET_QUOTE_BUF_LEN : u32 = 2048;
           let mut return_quote_buf : [u8; RET_QUOTE_BUF_LEN as usize] = [0;RET_QUOTE_BUF_LEN as usize];
           let p_quote = return_quote_buf.as_mut_ptr();
   
           let max_len = RET_QUOTE_BUF_LEN;
           let mut quote_len : u32 = 0;
           let p_quote_len = &mut quote_len as *mut u32;
   
           // NULL Pointer
           let (p_sigrl, sigrl_len) = (ptr::null() as *const u8, 0);
   
           let quote_nonce = sgx_quote_nonce_t::default();
           let p_nonce = &quote_nonce as * const sgx_quote_nonce_t;
   
           // Init Enclave
           let mut ti : sgx_target_info_t = sgx_target_info_t::default();
           let mut eg : sgx_epid_group_id_t = sgx_epid_group_id_t::default();
           let mut rt : sgx_status_t = sgx_status_t::SGX_ERROR_UNEXPECTED;
   
           let res = unsafe {
               rust_init_quote(&mut ti as *mut sgx_target_info_t,
                                &mut eg as *mut sgx_epid_group_id_t)
               };
   
           println!("eg = {:?}", eg);
   
           if res != sgx_status_t::SGX_SUCCESS {
               println!("Get error when init quote");
               return;
           }
   
           let result = unsafe {
               rust_get_quote(p_sigrl,
                              sigrl_len,
                              p_report,
                              quote_type,
                              p_spid,
                              p_nonce,
                              &mut qe_report as *mut sgx_report_t,
                              p_quote,
                              max_len,
                              p_quote_len)
               };
   ```
   Really confused. I was wondering whether it is because that I use a simulation mode.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@teaclave.apache.org
For additional commands, e-mail: notifications-help@teaclave.apache.org