Skip to content

Commit

Permalink
more flexible get_quote in aesm-client (fixes #116 and #113)
Browse files Browse the repository at this point in the history
- extended the `get_quote` function with quote type and nonce
- bumped aesm-client version to 0.4 (as function params changes)
and *-tools patch version (as nothing changed in them,
except for using a new version of aesm-client)
  • Loading branch information
tomtau committed Mar 18, 2020
1 parent 243570d commit bd5fa09
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 13 deletions.
6 changes: 3 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion aesm-client/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "aesm-client"
version = "0.3.1"
version = "0.4.0"
authors = ["Fortanix, Inc."]
license = "MPL-2.0"
description = """
Expand Down
6 changes: 4 additions & 2 deletions aesm-client/src/imp/unix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,12 +114,14 @@ impl AesmClient {
report: Vec<u8>,
spid: Vec<u8>,
sig_rl: Vec<u8>,
quote_type: QuoteType,
nonce: [u8; 16],
) -> Result<QuoteResult> {
let mut req = Request_GetQuoteRequest::new();
req.set_report(report);
req.set_quote_type(QuoteType::Linkable.into());
req.set_quote_type(quote_type.into());
req.set_spid(spid);
req.set_nonce(vec![0; 16]); // TODO: caller-supplied nonce
req.set_nonce(nonce.to_vec());
req.set_buf_size(session.quote_buffer_size(&sig_rl));
if sig_rl.len() != 0 {
req.set_sig_rl(sig_rl);
Expand Down
5 changes: 3 additions & 2 deletions aesm-client/src/imp/windows.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,9 @@ impl AesmClient {
report: Vec<u8>,
spid: Vec<u8>,
sig_rl: Vec<u8>,
quote_type: QuoteType,
nonce: [u8; 16],
) -> Result<QuoteResult> {
let nonce = [0u8; 64];
let quote_buffer_size = session.quote_buffer_size(&sig_rl);
let mut qe_report: Vec<u8> = vec![0; Report::UNPADDED_SIZE];
let mut quote: Vec<u8> = vec![0; quote_buffer_size as usize];
Expand All @@ -131,7 +132,7 @@ impl AesmClient {
assert_eq!(spid.len(), 16);
let error = (&self.library.get_quote)(
report.as_ptr() as _,
QuoteType::Linkable.into(),
quote_type.into(),
spid.as_ptr() as _,
nonce.as_ptr() as _,
sig_rl_in,
Expand Down
6 changes: 6 additions & 0 deletions aesm-client/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -179,12 +179,16 @@ impl AesmClient {
report: Vec<u8>,
spid: Vec<u8>,
sig_rl: Vec<u8>,
quote_type: QuoteType,
nonce: [u8; 16],
) -> Result<QuoteResult> {
self.inner.get_quote(
session,
report,
spid,
sig_rl,
quote_type,
nonce,
)
}

Expand Down Expand Up @@ -371,6 +375,8 @@ mod tests {
vec![0u8; Report::UNPADDED_SIZE],
vec![0u8; SPID_SIZE],
vec![],
QuoteType::Linkable,
[0; 16],
)
.unwrap_err();

Expand Down
4 changes: 3 additions & 1 deletion aesm-client/tests/live_quote.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ extern crate sgx_isa;
extern crate sgxs;
extern crate sgxs_loaders;

use aesm_client::AesmClient;
use aesm_client::{AesmClient, QuoteType};
use sgx_isa::Targetinfo;
#[cfg(unix)]
use sgxs_loaders::isgx::Device as IsgxDevice;
Expand All @@ -36,6 +36,8 @@ fn live_quote() {
report.as_ref().to_owned(),
DUMMY_SPID.to_vec(),
vec![],
QuoteType::Linkable,
[0; 16],
)
.expect("quote result");
}
4 changes: 2 additions & 2 deletions fortanix-sgx-tools/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "fortanix-sgx-tools"
version = "0.3.0"
version = "0.3.1"
authors = ["Fortanix, Inc."]
license = "MPL-2.0"
description = """
Expand All @@ -18,7 +18,7 @@ categories = ["development-tools::build-utils", "command-line-utilities"]

[dependencies]
# Project dependencies
aesm-client = { version = "0.3.0", path = "../aesm-client", features = ["sgxs"] }
aesm-client = { version = "0.4.0", path = "../aesm-client", features = ["sgxs"] }
sgxs-loaders = { version = "0.2.0", path = "../sgxs-loaders" }
enclave-runner = { version = "0.3.0", path = "../enclave-runner" }
sgxs = { version = "0.7.0", path = "../sgxs" }
Expand Down
4 changes: 2 additions & 2 deletions sgxs-tools/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "sgxs-tools"
version = "0.8.0"
version = "0.8.1"
authors = ["Fortanix, Inc."]
license = "MPL-2.0"
description = """
Expand Down Expand Up @@ -31,7 +31,7 @@ path = "src/sgx_detect/main.rs"
# Project dependencies
"sgxs" = { version = "0.7.0", path = "../sgxs", features = ["crypto-openssl"] }
"sgxs-loaders" = { version = "0.2.0", path = "../sgxs-loaders" }
"aesm-client" = { version = "0.3.0", path = "../aesm-client", features = ["sgxs"] }
"aesm-client" = { version = "0.4.0", path = "../aesm-client", features = ["sgxs"] }
"sgx-isa" = { version = "0.3.0", path = "../sgx-isa" }
"report-test" = { version = "0.3.0", path = "../report-test" }
"enclave-runner" = { version = "0.3.0", path = "../enclave-runner" }
Expand Down

0 comments on commit bd5fa09

Please sign in to comment.