Skip to content

Commit

Permalink
Fixing state provisioning without skip_ra flag (#2883)
Browse files Browse the repository at this point in the history
* skipping getting quote data when using Epid attestation type

* refactoring skip logic on bitacross-worker

* small optimization, avoiding fetch the api when skip_ra is true
  • Loading branch information
silva-fj committed Jul 11, 2024
1 parent c758c30 commit 0e33ee3
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
9 changes: 7 additions & 2 deletions bitacross-worker/service/src/enclave/tls_ra.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,12 @@ pub fn enclave_request_state_provisioning<E: TlsRemoteAttestation + RemoteAttest

let stream = TcpStream::connect(addr).map_err(|e| Error::Other(Box::new(e)))?;

let quoting_enclave_target_info = if !skip_ra {
#[cfg(not(feature = "dcap"))]
let get_quote_data = false;
#[cfg(feature = "dcap")]
let get_quote_data = !skip_ra;

let quoting_enclave_target_info = if get_quote_data {
match enclave_api.qe_get_target_info() {
Ok(quote_size) => Some(quote_size),
Err(e) => return Err(e),
Expand All @@ -92,7 +97,7 @@ pub fn enclave_request_state_provisioning<E: TlsRemoteAttestation + RemoteAttest
None
};

let quote_size = if !skip_ra {
let quote_size = if get_quote_data {
match enclave_api.qe_get_quote_size() {
Ok(quote_size) => Some(quote_size),
Err(e) => return Err(e),
Expand Down
9 changes: 7 additions & 2 deletions tee-worker/service/src/enclave/tls_ra.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,12 @@ pub fn enclave_request_state_provisioning<E: TlsRemoteAttestation + RemoteAttest

let stream = TcpStream::connect(addr).map_err(|e| Error::Other(Box::new(e)))?;

let quoting_enclave_target_info = if !skip_ra {
#[cfg(not(feature = "dcap"))]
let get_quote_data = false;
#[cfg(feature = "dcap")]
let get_quote_data = !skip_ra;

let quoting_enclave_target_info = if get_quote_data {
match enclave_api.qe_get_target_info() {
Ok(quote_size) => Some(quote_size),
Err(e) => return Err(e),
Expand All @@ -90,7 +95,7 @@ pub fn enclave_request_state_provisioning<E: TlsRemoteAttestation + RemoteAttest
None
};

let quote_size = if !skip_ra {
let quote_size = if get_quote_data {
match enclave_api.qe_get_quote_size() {
Ok(quote_size) => Some(quote_size),
Err(e) => return Err(e),
Expand Down

0 comments on commit 0e33ee3

Please sign in to comment.