Skip to content

Commit

Permalink
Comment out timeouts in sgx with FIXME #31
Browse files Browse the repository at this point in the history
  • Loading branch information
parthsane committed Mar 20, 2020
1 parent ed53444 commit c201c89
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions aesm-client/src/imp/sgx.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
use std::time::Duration;
use std::net::TcpStream;
use std::io::{Read,Write};

Expand All @@ -11,6 +10,9 @@ use {
Request_GetQuoteRequest, Request_InitQuoteRequest,
};

/*
// FIXME: uncomment this after resolving https://github.com/fortanix/rust-sgx/issues/31
use std::time::Duration;
/// This timeout is an argument in AESM request protobufs.
///
/// This value should be used for requests that can be completed locally, i.e.
Expand All @@ -21,6 +23,7 @@ const LOCAL_AESM_TIMEOUT_US: u32 = 1_000_000;
/// This value should be used for requests that might need interaction with
/// remote servers, such as provisioning EPID.
const REMOTE_AESM_TIMEOUT_US: u32 = 30_000_000;
*/

#[derive(Debug)]
pub struct AesmClient {
Expand All @@ -34,7 +37,8 @@ impl AesmClient {

fn open_socket(&self) -> Result<TcpStream> {
let sock = self.tcp_stream.try_clone()?;
let _ = sock.set_write_timeout(Some(Duration::from_micros(LOCAL_AESM_TIMEOUT_US as _)))?;
// FIXME: uncomment this after resolving https://github.com/fortanix/rust-sgx/issues/31
// let _ = sock.set_write_timeout(Some(Duration::from_micros(LOCAL_AESM_TIMEOUT_US as _)))?;
Ok(sock)
}

Expand All @@ -45,7 +49,8 @@ impl AesmClient {
fn transact<T: AesmRequest>(&self, req: T) -> Result<T::Response> {
let mut sock = self.open_socket()?;

let _ = sock.set_read_timeout(req.get_timeout().map(|t| Duration::from_micros(t as _)))?;
// FIXME: uncomment this after resolving https://github.com/fortanix/rust-sgx/issues/31
// let _ = sock.set_read_timeout(req.get_timeout().map(|t| Duration::from_micros(t as _)))?;

let req_bytes = req
.into()
Expand All @@ -64,8 +69,9 @@ impl AesmClient {

/// Obtain target info from QE.
pub fn init_quote(&self) -> Result<QuoteInfo> {
let mut req = Request_InitQuoteRequest::new();
req.set_timeout(LOCAL_AESM_TIMEOUT_US);
let req = Request_InitQuoteRequest::new();
// FIXME: uncomment this after resolving https://github.com/fortanix/rust-sgx/issues/31
// req.set_timeout(LOCAL_AESM_TIMEOUT_US);

let mut res = self.transact(req)?;

Expand Down Expand Up @@ -97,7 +103,9 @@ impl AesmClient {
req.set_sig_rl(sig_rl);
}
req.set_qe_report(true);
req.set_timeout(REMOTE_AESM_TIMEOUT_US);

// FIXME: uncomment this after resolving https://github.com/fortanix/rust-sgx/issues/31
// req.set_timeout(REMOTE_AESM_TIMEOUT_US);

let mut res = self.transact(req)?;

Expand Down

0 comments on commit c201c89

Please sign in to comment.