Skip to content

Commit 0e33ee3

Browse files
authored
Fixing state provisioning without skip_ra flag (#2883)
* 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
1 parent c758c30 commit 0e33ee3

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

bitacross-worker/service/src/enclave/tls_ra.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,12 @@ pub fn enclave_request_state_provisioning<E: TlsRemoteAttestation + RemoteAttest
8383

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

86-
let quoting_enclave_target_info = if !skip_ra {
86+
#[cfg(not(feature = "dcap"))]
87+
let get_quote_data = false;
88+
#[cfg(feature = "dcap")]
89+
let get_quote_data = !skip_ra;
90+
91+
let quoting_enclave_target_info = if get_quote_data {
8792
match enclave_api.qe_get_target_info() {
8893
Ok(quote_size) => Some(quote_size),
8994
Err(e) => return Err(e),
@@ -92,7 +97,7 @@ pub fn enclave_request_state_provisioning<E: TlsRemoteAttestation + RemoteAttest
9297
None
9398
};
9499

95-
let quote_size = if !skip_ra {
100+
let quote_size = if get_quote_data {
96101
match enclave_api.qe_get_quote_size() {
97102
Ok(quote_size) => Some(quote_size),
98103
Err(e) => return Err(e),

tee-worker/service/src/enclave/tls_ra.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,12 @@ pub fn enclave_request_state_provisioning<E: TlsRemoteAttestation + RemoteAttest
8181

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

84-
let quoting_enclave_target_info = if !skip_ra {
84+
#[cfg(not(feature = "dcap"))]
85+
let get_quote_data = false;
86+
#[cfg(feature = "dcap")]
87+
let get_quote_data = !skip_ra;
88+
89+
let quoting_enclave_target_info = if get_quote_data {
8590
match enclave_api.qe_get_target_info() {
8691
Ok(quote_size) => Some(quote_size),
8792
Err(e) => return Err(e),
@@ -90,7 +95,7 @@ pub fn enclave_request_state_provisioning<E: TlsRemoteAttestation + RemoteAttest
9095
None
9196
};
9297

93-
let quote_size = if !skip_ra {
98+
let quote_size = if get_quote_data {
9499
match enclave_api.qe_get_quote_size() {
95100
Ok(quote_size) => Some(quote_size),
96101
Err(e) => return Err(e),

0 commit comments

Comments
 (0)