Skip to content

Commit

Permalink
Merge #219
Browse files Browse the repository at this point in the history
219: more flexible get_quote in aesm-client (fixes #116 and #113) r=jethrogb a=tomtau

- extended the `get_quote` function with quote type and nonce
- bumped aesm-client version to 0.4 (as function params changed)
and *-tools patch version (as nothing changed in them,
except for using a new version of aesm-client)

Co-authored-by: Tomas Tauber <[email protected]>
  • Loading branch information
bors[bot] and tomtau authored Mar 19, 2020
2 parents 243570d + 3ba8664 commit bb10e94
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 14 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: Vec<u8>,
) -> 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);
req.set_buf_size(session.quote_buffer_size(&sig_rl));
if sig_rl.len() != 0 {
req.set_sig_rl(sig_rl);
Expand Down
8 changes: 5 additions & 3 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: Vec<u8>,
) -> 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 @@ -129,11 +130,12 @@ impl AesmClient {
};
assert_eq!(qe_report.len(), Report::UNPADDED_SIZE);
assert_eq!(spid.len(), 16);
assert_eq!(nonce.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 _,
&nonce[0],
sig_rl_in,
sig_rl_size_in as _,
qe_report.as_mut_ptr() as _,
Expand Down
7 changes: 7 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: Vec<u8>,
) -> Result<QuoteResult> {
self.inner.get_quote(
session,
report,
spid,
sig_rl,
quote_type,
nonce,
)
}

Expand Down Expand Up @@ -345,6 +349,7 @@ mod tests {
use super::*;

const SPID_SIZE: usize = 16;
const NONCE_SIZE: usize = 16;

#[test]
fn test_init_quote() {
Expand All @@ -371,6 +376,8 @@ mod tests {
vec![0u8; Report::UNPADDED_SIZE],
vec![0u8; SPID_SIZE],
vec![],
QuoteType::Linkable,
vec![0u8; NONCE_SIZE],
)
.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].to_vec(),
)
.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 bb10e94

Please sign in to comment.