diff --git a/intel-sgx/Cargo.lock b/intel-sgx/Cargo.lock index 2c9bc0e..a8e7227 100644 --- a/intel-sgx/Cargo.lock +++ b/intel-sgx/Cargo.lock @@ -1,15 +1,28 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. +[[package]] +name = "aho-corasick" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "ansi_term" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "attestation-daemon" version = "0.1.0" dependencies = [ - "bufstream 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "dcap-ql 0.2.0 (git+https://github.com/lkatalin/rust-sgx?branch=serde-pck)", - "hex 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", - "openssl 0.10.24 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.101 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.102 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.41 (registry+https://github.com/rust-lang/crates.io-index)", "sgx-isa 0.3.1 (git+https://github.com/lkatalin/rust-sgx?branch=serde-pck)", ] @@ -17,8 +30,9 @@ dependencies = [ name = "attestation-enclave" version = "0.1.0" dependencies = [ - "bufstream 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)", + "byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "mbedtls 0.4.0 (git+https://github.com/haraldh/rust-mbedtls?branch=upstream_bindgen)", + "serde_json 1.0.41 (registry+https://github.com/rust-lang/crates.io-index)", "sgx-isa 0.3.1 (git+https://github.com/lkatalin/rust-sgx?branch=serde-pck)", ] @@ -27,41 +41,74 @@ name = "attestation-tenant" version = "0.1.0" dependencies = [ "bufstream 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "dcap-ql 0.2.0 (git+https://github.com/lkatalin/rust-sgx?branch=serde-pck)", - "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "hex 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", - "openssl 0.10.24 (registry+https://github.com/rust-lang/crates.io-index)", + "failure 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "mbedtls 0.4.0 (git+https://github.com/haraldh/rust-mbedtls?branch=upstream_bindgen)", + "openssl 0.10.25 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.41 (registry+https://github.com/rust-lang/crates.io-index)", "sgx-isa 0.3.1 (git+https://github.com/lkatalin/rust-sgx?branch=serde-pck)", ] +[[package]] +name = "atty" +version = "0.2.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "autocfg" -version = "0.1.6" +version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "backtrace" -version = "0.3.38" +version = "0.3.40" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "backtrace-sys 0.1.31 (registry+https://github.com/rust-lang/crates.io-index)", - "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)", + "backtrace-sys 0.1.32 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-demangle 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "backtrace-sys" -version = "0.1.31" +version = "0.1.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cc 1.0.46 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "bindgen" +version = "0.51.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cc 1.0.45 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)", + "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "cexpr 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "clang-sys 0.28.1 (registry+https://github.com/rust-lang/crates.io-index)", + "clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)", + "env_logger 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", + "peeking_take_while 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-hash 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "shlex 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "which 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "bitflags" -version = "1.1.0" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -76,13 +123,53 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "cc" -version = "1.0.45" +version = "1.0.46" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "cexpr" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "nom 4.2.3 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "cfg-if" -version = "0.1.9" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "clang-sys" +version = "0.28.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "glob 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)", + "libloading 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "clap" +version = "2.33.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", + "atty 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)", + "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "strsim 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", + "textwrap 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-width 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "vec_map 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "cmake" +version = "0.1.42" source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cc 1.0.46 (registry+https://github.com/rust-lang/crates.io-index)", +] [[package]] name = "dcap-ql" @@ -91,12 +178,12 @@ source = "git+https://github.com/lkatalin/rust-sgx?branch=serde-pck#aa81839e714a dependencies = [ "byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "dcap-ql-sys 0.2.0 (git+https://github.com/lkatalin/rust-sgx?branch=serde-pck)", - "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "failure 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)", "num-derive 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", "num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", - "openssl 0.10.24 (registry+https://github.com/rust-lang/crates.io-index)", + "openssl 0.10.25 (registry+https://github.com/rust-lang/crates.io-index)", "percent-encoding 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "sgx-isa 0.3.1 (git+https://github.com/lkatalin/rust-sgx?branch=serde-pck)", "sgxs-loaders 0.2.1 (git+https://github.com/lkatalin/rust-sgx?branch=serde-pck)", @@ -112,24 +199,36 @@ dependencies = [ "sgx-isa 0.3.1 (git+https://github.com/lkatalin/rust-sgx?branch=serde-pck)", ] +[[package]] +name = "env_logger" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "atty 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)", + "humantime 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "termcolor 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "failure" -version = "0.1.5" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "backtrace 0.3.38 (registry+https://github.com/rust-lang/crates.io-index)", - "failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "backtrace 0.3.40 (registry+https://github.com/rust-lang/crates.io-index)", + "failure_derive 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "failure_derive" -version = "0.1.5" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.44 (registry+https://github.com/rust-lang/crates.io-index)", - "synstructure 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)", + "synstructure 0.12.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -146,10 +245,18 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] -name = "hex" -version = "0.3.2" +name = "glob" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "humantime" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "quick-error 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "itoa" version = "0.4.4" @@ -162,7 +269,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "libc" -version = "0.2.62" +version = "0.2.65" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -170,22 +277,68 @@ name = "libloading" version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cc 1.0.45 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.46 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "log" +version = "0.4.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "mbedtls" +version = "0.4.0" +source = "git+https://github.com/haraldh/rust-mbedtls?branch=upstream_bindgen#1e3d0a32421528aca54eb491a1635076b5beae66" +dependencies = [ + "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.46 (registry+https://github.com/rust-lang/crates.io-index)", + "mbedtls-sys-auto 2.18.0 (git+https://github.com/haraldh/rust-mbedtls?branch=upstream_bindgen)", + "rs-libc 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.102 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.102 (registry+https://github.com/rust-lang/crates.io-index)", + "yasna 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "mbedtls-sys-auto" +version = "2.18.0" +source = "git+https://github.com/haraldh/rust-mbedtls?branch=upstream_bindgen#1e3d0a32421528aca54eb491a1635076b5beae66" +dependencies = [ + "bindgen 0.51.1 (registry+https://github.com/rust-lang/crates.io-index)", + "cmake 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "memchr" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "nix" version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "cc 1.0.45 (registry+https://github.com/rust-lang/crates.io-index)", - "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)", + "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.46 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)", "void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "nom" +version = "4.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "num-derive" version = "0.2.5" @@ -201,34 +354,39 @@ name = "num-traits" version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "autocfg 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "autocfg 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "openssl" -version = "0.10.24" +version = "0.10.25" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", + "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", "foreign-types 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)", - "openssl-sys 0.9.49 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)", + "openssl-sys 0.9.52 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "openssl-sys" -version = "0.9.49" +version = "0.9.52" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "autocfg 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", - "cc 1.0.45 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)", + "autocfg 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.46 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)", "pkg-config 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)", "vcpkg 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "peeking_take_while" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "percent-encoding" version = "2.1.0" @@ -249,12 +407,17 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.4" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "quick-error" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "quote" version = "0.6.13" @@ -268,7 +431,7 @@ name = "quote" version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro2 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -276,22 +439,54 @@ name = "redox_syscall" version = "0.1.56" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "regex" +version = "1.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "aho-corasick 0.7.6 (registry+https://github.com/rust-lang/crates.io-index)", + "memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "regex-syntax 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", + "thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "regex-syntax" +version = "0.6.12" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "rs-libc" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cc 1.0.46 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "rustc-demangle" version = "0.1.16" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "rustc-hash" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "ryu" -version = "1.0.0" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "serde" -version = "1.0.101" +version = "1.0.102" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "serde_derive 1.0.101 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.102 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -299,28 +494,28 @@ name = "serde-big-array" version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "serde 1.0.101 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.101 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.102 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.102 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "serde_derive" -version = "1.0.101" +version = "1.0.102" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro2 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "serde_json" -version = "1.0.40" +version = "1.0.41" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "itoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", - "ryu 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.101 (registry+https://github.com/rust-lang/crates.io-index)", + "ryu 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.102 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -328,8 +523,8 @@ name = "sgx-isa" version = "0.3.1" source = "git+https://github.com/lkatalin/rust-sgx?branch=serde-pck#aa81839e714ad7501e6ef44b2d4e61c8574548d4" dependencies = [ - "bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.101 (registry+https://github.com/rust-lang/crates.io-index)", + "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.102 (registry+https://github.com/rust-lang/crates.io-index)", "serde-big-array 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -339,8 +534,8 @@ version = "0.7.1" source = "git+https://github.com/lkatalin/rust-sgx?branch=serde-pck#aa81839e714ad7501e6ef44b2d4e61c8574548d4" dependencies = [ "byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)", - "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "failure 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "failure_derive 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "sgx-isa 0.3.1 (git+https://github.com/lkatalin/rust-sgx?branch=serde-pck)", "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -350,10 +545,10 @@ name = "sgxs-loaders" version = "0.2.1" source = "git+https://github.com/lkatalin/rust-sgx?branch=serde-pck#aa81839e714ad7501e6ef44b2d4e61c8574548d4" dependencies = [ - "bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)", + "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "failure 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "failure_derive 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)", "libloading 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", "nix 0.11.1 (registry+https://github.com/rust-lang/crates.io-index)", "sgx-isa 0.3.1 (git+https://github.com/lkatalin/rust-sgx?branch=serde-pck)", @@ -361,6 +556,16 @@ dependencies = [ "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "shlex" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "strsim" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "syn" version = "0.15.44" @@ -373,23 +578,47 @@ dependencies = [ [[package]] name = "syn" -version = "1.0.5" +version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro2 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "synstructure" -version = "0.10.2" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.44 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "termcolor" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "wincolor 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "textwrap" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "unicode-width 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "thread_local" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -397,11 +626,16 @@ name = "time" version = "0.1.42" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)", "redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "unicode-width" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "unicode-xid" version = "0.1.0" @@ -417,11 +651,29 @@ name = "vcpkg" version = "0.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "vec_map" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "version_check" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "void" version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "which" +version = "3.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "winapi" version = "0.3.8" @@ -436,60 +688,115 @@ name = "winapi-i686-pc-windows-gnu" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "winapi-util" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "winapi-x86_64-pc-windows-gnu" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "wincolor" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi-util 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "yasna" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" + [metadata] -"checksum autocfg 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "b671c8fb71b457dd4ae18c4ba1e59aa81793daacc361d82fcd410cef0d491875" -"checksum backtrace 0.3.38 (registry+https://github.com/rust-lang/crates.io-index)" = "690a62be8920ccf773ee00ef0968649b0e724cda8bd5b12286302b4ae955fdf5" -"checksum backtrace-sys 0.1.31 (registry+https://github.com/rust-lang/crates.io-index)" = "82a830b4ef2d1124a711c71d263c5abdc710ef8e907bd508c88be475cebc422b" -"checksum bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3d155346769a6855b86399e9bc3814ab343cd3d62c7e985113d46a0ec3c281fd" +"checksum aho-corasick 0.7.6 (registry+https://github.com/rust-lang/crates.io-index)" = "58fb5e95d83b38284460a5fda7d6470aa0b8844d283a0b614b8535e880800d2d" +"checksum ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b" +"checksum atty 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)" = "1803c647a3ec87095e7ae7acfca019e98de5ec9a7d01343f611cf3152ed71a90" +"checksum autocfg 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "1d49d90015b3c36167a20fe2810c5cd875ad504b39cff3d4eae7977e6b7c1cb2" +"checksum backtrace 0.3.40 (registry+https://github.com/rust-lang/crates.io-index)" = "924c76597f0d9ca25d762c25a4d369d51267536465dc5064bdf0eb073ed477ea" +"checksum backtrace-sys 0.1.32 (registry+https://github.com/rust-lang/crates.io-index)" = "5d6575f128516de27e3ce99689419835fce9643a9b215a14d2b5b685be018491" +"checksum bindgen 0.51.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ebd71393f1ec0509b553aa012b9b58e81dadbdff7130bd3b8cba576e69b32f75" +"checksum bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693" "checksum bufstream 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "40e38929add23cdf8a366df9b0e088953150724bcbe5fc330b0d8eb3b328eec8" "checksum byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a7c3dd8985a7111efc5c80b44e23ecdd8c007de8ade3b96595387e812b957cf5" -"checksum cc 1.0.45 (registry+https://github.com/rust-lang/crates.io-index)" = "4fc9a35e1f4290eb9e5fc54ba6cf40671ed2a2514c3eeb2b2a908dda2ea5a1be" -"checksum cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "b486ce3ccf7ffd79fdeb678eac06a9e6c09fc88d33836340becb8fffe87c5e33" +"checksum cc 1.0.46 (registry+https://github.com/rust-lang/crates.io-index)" = "0213d356d3c4ea2c18c40b037c3be23cd639825c18f25ee670ac7813beeef99c" +"checksum cexpr 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "a7fa24eb00d5ffab90eaeaf1092ac85c04c64aaf358ea6f84505b8116d24c6af" +"checksum cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" +"checksum clang-sys 0.28.1 (registry+https://github.com/rust-lang/crates.io-index)" = "81de550971c976f176130da4b2978d3b524eaa0fd9ac31f3ceb5ae1231fb4853" +"checksum clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5067f5bb2d80ef5d68b4c87db81601f0b75bca627bc2ef76b141d7b846a3c6d9" +"checksum cmake 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)" = "81fb25b677f8bf1eb325017cb6bb8452f87969db0fedb4f757b297bee78a7c62" "checksum dcap-ql 0.2.0 (git+https://github.com/lkatalin/rust-sgx?branch=serde-pck)" = "" "checksum dcap-ql-sys 0.2.0 (git+https://github.com/lkatalin/rust-sgx?branch=serde-pck)" = "" -"checksum failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "795bd83d3abeb9220f257e597aa0080a508b27533824adf336529648f6abf7e2" -"checksum failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "ea1063915fd7ef4309e222a5a07cf9c319fb9c7836b1f89b85458672dbb127e1" +"checksum env_logger 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "aafcde04e90a5226a6443b7aabdb016ba2f8307c847d524724bd9b346dd1a2d3" +"checksum failure 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "f8273f13c977665c5db7eb2b99ae520952fe5ac831ae4cd09d80c4c7042b5ed9" +"checksum failure_derive 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "0bc225b78e0391e4b8683440bf2e63c2deeeb2ce5189eab46e2b68c6d3725d08" "checksum foreign-types 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" "checksum foreign-types-shared 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" -"checksum hex 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "805026a5d0141ffc30abb3be3173848ad46a1b1664fe632428479619a3644d77" +"checksum glob 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574" +"checksum humantime 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "df004cfca50ef23c36850aaaa59ad52cc70d0e90243c3c7737a4dd32dc7a3c4f" "checksum itoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "501266b7edd0174f8530248f87f99c88fbe60ca4ef3dd486835b8d8d53136f7f" "checksum lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" -"checksum libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)" = "34fcd2c08d2f832f376f4173a231990fa5aef4e99fb569867318a227ef4c06ba" +"checksum libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)" = "1a31a0627fdf1f6a39ec0dd577e101440b7db22672c0901fe00a9a6fbb5c24e8" "checksum libloading 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f2b111a074963af1d37a139918ac6d49ad1d0d5e47f72fd55388619691a7d753" +"checksum log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)" = "14b6052be84e6b71ab17edffc2eeabf5c2c3ae1fdb464aae35ac50c67a44e1f7" +"checksum mbedtls 0.4.0 (git+https://github.com/haraldh/rust-mbedtls?branch=upstream_bindgen)" = "" +"checksum mbedtls-sys-auto 2.18.0 (git+https://github.com/haraldh/rust-mbedtls?branch=upstream_bindgen)" = "" +"checksum memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "88579771288728879b57485cc7d6b07d648c9f0141eb955f8ab7f9d45394468e" "checksum nix 0.11.1 (registry+https://github.com/rust-lang/crates.io-index)" = "becb657d662f1cd2ef38c7ad480ec6b8cf9e96b27adb543e594f9cf0f2e6065c" +"checksum nom 4.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2ad2a91a8e869eeb30b9cb3119ae87773a8f4ae617f41b1eb9c154b2905f7bd6" "checksum num-derive 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "eafd0b45c5537c3ba526f79d3e75120036502bebacbb3f3220914067ce39dbf2" "checksum num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "6ba9a427cfca2be13aa6f6403b0b7e7368fe982bfa16fccc450ce74c46cd9b32" -"checksum openssl 0.10.24 (registry+https://github.com/rust-lang/crates.io-index)" = "8152bb5a9b5b721538462336e3bef9a539f892715e5037fda0f984577311af15" -"checksum openssl-sys 0.9.49 (registry+https://github.com/rust-lang/crates.io-index)" = "f4fad9e54bd23bd4cbbe48fdc08a1b8091707ac869ef8508edea2fec77dcc884" +"checksum openssl 0.10.25 (registry+https://github.com/rust-lang/crates.io-index)" = "2f372b2b53ce10fb823a337aaa674e3a7d072b957c6264d0f4ff0bd86e657449" +"checksum openssl-sys 0.9.52 (registry+https://github.com/rust-lang/crates.io-index)" = "c977d08e1312e2f7e4b86f9ebaa0ed3b19d1daff75fae88bbb88108afbd801fc" +"checksum peeking_take_while 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "19b17cddbe7ec3f8bc800887bab5e717348c95ea2ca0b1bf0837fb964dc67099" "checksum percent-encoding 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e" "checksum pkg-config 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)" = "72d5370d90f49f70bd033c3d75e87fc529fbfff9d6f7cccef07d6170079d91ea" "checksum proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)" = "cf3d2011ab5c909338f7887f4fc896d35932e29146c12c8d01da6b22a80ba759" -"checksum proc-macro2 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "afdc77cc74ec70ed262262942ebb7dac3d479e9e5cfa2da1841c0806f6cdabcc" +"checksum proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "9c9e470a8dc4aeae2dee2f335e8f533e2d4b347e1434e5671afc49b054592f27" +"checksum quick-error 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9274b940887ce9addde99c4eee6b5c44cc494b182b97e73dc8ffdcb3397fd3f0" "checksum quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)" = "6ce23b6b870e8f94f81fb0a363d65d86675884b34a09043c81e5562f11c1f8e1" "checksum quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "053a8c8bcc71fcce321828dc897a98ab9760bef03a4fc36693c231e5b3216cfe" "checksum redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)" = "2439c63f3f6139d1b57529d16bc3b8bb855230c8efcc5d3a896c8bea7c3b1e84" +"checksum regex 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "dc220bd33bdce8f093101afe22a037b8eb0e5af33592e6a9caafff0d4cb81cbd" +"checksum regex-syntax 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)" = "11a7e20d1cce64ef2fed88b66d347f88bd9babb82845b2b858f3edbf59a4f716" +"checksum rs-libc 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "80a671d6c4696a49b78e0a271c99bc58bc1a17a64893a3684a1ba1a944b26ca9" "checksum rustc-demangle 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)" = "4c691c0e608126e00913e33f0ccf3727d5fc84573623b8d65b2df340b5201783" -"checksum ryu 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c92464b447c0ee8c4fb3824ecc8383b81717b9f1e74ba2e72540aef7b9f82997" -"checksum serde 1.0.101 (registry+https://github.com/rust-lang/crates.io-index)" = "9796c9b7ba2ffe7a9ce53c2287dfc48080f4b2b362fcc245a259b3a7201119dd" +"checksum rustc-hash 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7540fc8b0c49f096ee9c961cda096467dce8084bec6bdca2fc83895fd9b28cb8" +"checksum ryu 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "bfa8506c1de11c9c4e4c38863ccbe02a305c8188e85a05a784c9e11e1c3910c8" +"checksum serde 1.0.102 (registry+https://github.com/rust-lang/crates.io-index)" = "0c4b39bd9b0b087684013a792c59e3e07a46a01d2322518d8a1104641a0b1be0" "checksum serde-big-array 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "b926cfbabfe8011609dda0350cb24d884955d294909ac71c0db7027366c77e3e" -"checksum serde_derive 1.0.101 (registry+https://github.com/rust-lang/crates.io-index)" = "4b133a43a1ecd55d4086bd5b4dc6c1751c68b1bfbeba7a5040442022c7e7c02e" -"checksum serde_json 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)" = "051c49229f282f7c6f3813f8286cc1e3323e8051823fce42c7ea80fe13521704" +"checksum serde_derive 1.0.102 (registry+https://github.com/rust-lang/crates.io-index)" = "ca13fc1a832f793322228923fbb3aba9f3f44444898f835d31ad1b74fa0a2bf8" +"checksum serde_json 1.0.41 (registry+https://github.com/rust-lang/crates.io-index)" = "2f72eb2a68a7dc3f9a691bfda9305a1c017a6215e5a4545c258500d2099a37c2" "checksum sgx-isa 0.3.1 (git+https://github.com/lkatalin/rust-sgx?branch=serde-pck)" = "" "checksum sgxs 0.7.1 (git+https://github.com/lkatalin/rust-sgx?branch=serde-pck)" = "" "checksum sgxs-loaders 0.2.1 (git+https://github.com/lkatalin/rust-sgx?branch=serde-pck)" = "" +"checksum shlex 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7fdf1b9db47230893d76faad238fd6097fd6d6a9245cd7a4d90dbd639536bbd2" +"checksum strsim 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" "checksum syn 0.15.44 (registry+https://github.com/rust-lang/crates.io-index)" = "9ca4b3b69a77cbe1ffc9e198781b7acb0c7365a883670e8f1c1bc66fba79a5c5" -"checksum syn 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "66850e97125af79138385e9b88339cbcd037e3f28ceab8c5ad98e64f0f1f80bf" -"checksum synstructure 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)" = "02353edf96d6e4dc81aea2d8490a7e9db177bf8acb0e951c24940bf866cb313f" +"checksum syn 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)" = "0e7bedb3320d0f3035594b0b723c8a28d7d336a3eda3881db79e61d676fb644c" +"checksum synstructure 0.12.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3f085a5855930c0441ca1288cf044ea4aecf4f43a91668abdb870b4ba546a203" +"checksum termcolor 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "96d6098003bde162e4277c70665bd87c326f5a0c3f3fbfb285787fa482d54e6e" +"checksum textwrap 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060" +"checksum thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c6b53e329000edc2b34dbe8545fd20e55a333362d0a321909685a19bd28c3f1b" "checksum time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)" = "db8dcfca086c1143c9270ac42a2bbd8a7ee477b78ac8e45b19abfb0cbede4b6f" +"checksum unicode-width 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "7007dbd421b92cc6e28410fe7362e2e0a2503394908f417b68ec8d1c364c4e20" "checksum unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc" "checksum unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "826e7639553986605ec5979c7dd957c7895e93eabed50ab2ffa7f6128a75097c" "checksum vcpkg 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)" = "33dd455d0f96e90a75803cfeb7f948768c08d70a6de9a8d2362461935698bf95" +"checksum vec_map 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "05c78687fb1a80548ae3250346c3db86a80a7cdd77bda190189f2d0a0987c81a" +"checksum version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "914b1a6776c4c929a602fafd8bc742e06365d4bcbe48c30f9cca5824f70dc9dd" "checksum void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" +"checksum which 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "240a31163872f7e8e49f35b42b58485e35355b07eb009d9f3686733541339a69" "checksum winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "8093091eeb260906a183e6ae1abdba2ef5ef2257a21801128899c3fc699229c6" "checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" +"checksum winapi-util 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7168bab6e1daee33b4557efd0e95d5ca70a03706d39fa5f3fe7a236f584b03c9" "checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" +"checksum wincolor 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "96f5016b18804d24db43cebf3c77269e7569b8954a8464501c216cc5e070eaa9" +"checksum yasna 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "79af3189e6b0484c9fd54208f8eeb8818cadee00ec81438b67a64c8e6f2f3694" diff --git a/intel-sgx/Cargo.toml b/intel-sgx/Cargo.toml index 076444a..580adeb 100644 --- a/intel-sgx/Cargo.toml +++ b/intel-sgx/Cargo.toml @@ -4,3 +4,4 @@ members = ['attestation-enclave', 'attestation-daemon', 'attestation-tenant'] [patch.crates-io] dcap-ql = { git = "https://github.com/lkatalin/rust-sgx", branch = "serde-pck", rev = "aa81839e714ad7501e6ef44b2d4e61c8574548d4" } sgx-isa = { git = "https://github.com/lkatalin/rust-sgx", branch = "serde-pck", rev = "aa81839e714ad7501e6ef44b2d4e61c8574548d4" } +mbedtls = { git = "https://github.com/haraldh/rust-mbedtls", branch = "upstream_bindgen" } diff --git a/intel-sgx/attestation-daemon/Cargo.toml b/intel-sgx/attestation-daemon/Cargo.toml index ad9c68c..fd80ddd 100644 --- a/intel-sgx/attestation-daemon/Cargo.toml +++ b/intel-sgx/attestation-daemon/Cargo.toml @@ -5,11 +5,8 @@ authors = ["Lily Sturmann "] edition = "2018" [dependencies] -openssl = "0.10.23" -hex = "0.3.1" dcap-ql = "0.2.0" serde_json = "1.0.40" -bufstream = "0.1.4" serde = { version = "1.0", features = ["derive"] } [dependencies.sgx-isa] diff --git a/intel-sgx/attestation-daemon/src/main.rs b/intel-sgx/attestation-daemon/src/main.rs index 974299a..f4af7b8 100644 --- a/intel-sgx/attestation-daemon/src/main.rs +++ b/intel-sgx/attestation-daemon/src/main.rs @@ -1,6 +1,6 @@ +use serde_json::{from_reader, to_writer}; use std::error::Error; -use std::io::Write; -use std::net::{TcpListener, TcpStream}; +use std::net::{Shutdown, TcpListener, TcpStream}; const LISTENER_CONN: &'static str = "localhost:1034"; const ENCLAVE_CONN: &'static str = "localhost:1032"; @@ -19,24 +19,23 @@ fn main() -> Result<(), Box> { // used as the target for the enclave's attestation Report. let qe_ti = dcap_ql::target_info().expect("Could not retrieve QE target info."); - // Serialize the Target Info onto the stream to the enclave let mut enclave_stream = TcpStream::connect(ENCLAVE_CONN)?; - serde_json::to_writer(&mut enclave_stream, &qe_ti)?; - enclave_stream.shutdown(std::net::Shutdown::Write)?; + to_writer(&mut enclave_stream, &qe_ti)?; + enclave_stream.shutdown(Shutdown::Write)?; // The attestation daemon receives the Report back from the attesting enclave. - let report: sgx_isa::Report = serde_json::from_reader(&mut enclave_stream)?; + let report: sgx_isa::Report = from_reader(enclave_stream)?; // The attestation daemon gets a Quote from the Quoting Enclave for the Report. // The Quoting Enclave verifies the Report's MAC as a prerequisite for generating // the Quote. The Quote is signed with the Quoting Enclave's Attestation Key. let quote = dcap_ql::quote(&report).expect("Could not generate quote."); - // The attestation daemon sends the Quote to the tenant. let mut tenant_stream = incoming_tenant_stream?; - tenant_stream.write("e)?; + to_writer(&mut tenant_stream, "e)?; + tenant_stream.shutdown(Shutdown::Write)?; - println!("\nQuote successfully generated and sent to tenant..."); + println!("\nQuote successfully generated and sent to tenant."); } Ok(()) } diff --git a/intel-sgx/attestation-enclave/Cargo.toml b/intel-sgx/attestation-enclave/Cargo.toml index 17dc235..296845e 100644 --- a/intel-sgx/attestation-enclave/Cargo.toml +++ b/intel-sgx/attestation-enclave/Cargo.toml @@ -6,9 +6,9 @@ edition = "2018" [dependencies] serde_json = "1.0" -bufstream = "0.1.4" +byteorder = "1" -# The sgx-isa crate allows the use of Fortanix's data structures +# The sgx-isa crate allows the use of Fortanix's data structures # relating to SGX, ex. Report, TargetInfo. The sgxstd feature # should be enabled when using std::os::fortanix_sgx functionality, # ex. ENCLU[EGETKEY] and ENCLU[EREPORT]. Serde_support allows for the @@ -17,3 +17,10 @@ bufstream = "0.1.4" [dependencies.sgx-isa] version = "0.3.1" features = ["serde_support", "sgxstd"] + +[dependencies.mbedtls] +git = "https://github.com/haraldh/rust-mbedtls" +branch = "upstream_bindgen" +package = "mbedtls" +default-features = false +features = ["rdrand", "sgx"] diff --git a/intel-sgx/attestation-enclave/src/main.rs b/intel-sgx/attestation-enclave/src/main.rs index 10ac97f..629f99a 100644 --- a/intel-sgx/attestation-enclave/src/main.rs +++ b/intel-sgx/attestation-enclave/src/main.rs @@ -1,34 +1,192 @@ +use byteorder::{ByteOrder, NativeEndian, ReadBytesExt}; +use mbedtls::{ + cipher::*, + ecp::{EcGroup, EcPoint}, + hash::{Md, Type::Sha256}, + pk::{EcGroupId, Pk}, + rng::{CtrDrbg, Random, Rdseed}, +}; +use serde_json::{from_reader, to_writer, Deserializer}; use sgx_isa::Report; -use std::error::Error; -use std::net::TcpListener; +use std::{error::Error, io::Cursor, net::TcpListener}; -const LISTENER_ADDR: &'static str = "localhost:1032"; +const DAEMON_LISTENER_ADDR: &'static str = "localhost:1032"; +const TENANT_LISTENER_ADDR: &'static str = "localhost:1066"; + +// This copies the enclave key to the report data +fn from_slice(bytes: &[u8]) -> [u8; 64] { + let mut array = [0; 64]; + let bytes = &bytes[..array.len()]; // panics if not enough data + array.copy_from_slice(bytes); + array +} + +// Creates an AES 256 GCM cipher instance with the symmetric key and initialization vector +// set for each decryption operation. +fn new_aes256gcm_decrypt_cipher( + symm_key: &[u8], + iv: &[u8], +) -> Result, Box> { + let c = Cipher::<_, Authenticated, _>::new( + raw::CipherId::Aes, + raw::CipherMode::GCM, + (symm_key.len() * 8) as _, + )?; + + Ok(c.set_key_iv(&symm_key, &iv)?) +} + +// Creates an AES 256 GCM cipher instance with the symmetric key and initialization vector +// set for each encryption operation. +// TODO: This is redundant, but I can't return a Cipher<_, Authenticated, AdditionalData>, so I need two separate +// functions. How to fix? +fn new_aes256gcm_encrypt_cipher( + symm_key: &[u8], + iv: &[u8], +) -> Result, Box> { + let c = Cipher::<_, Authenticated, _>::new( + raw::CipherId::Aes, + raw::CipherMode::GCM, + (symm_key.len() * 8) as _, + )?; + + Ok(c.set_key_iv(&symm_key, &iv)?) +} fn main() -> Result<(), Box> { - println!("\nListening on {}....\n", LISTENER_ADDR); + println!( + "\nListening on {} and {}....\n", + DAEMON_LISTENER_ADDR, TENANT_LISTENER_ADDR + ); - // The enclave handles each incoming connection from attestation daemon. - for stream in TcpListener::bind(LISTENER_ADDR).unwrap().incoming() { + let daemon_streams = TcpListener::bind(DAEMON_LISTENER_ADDR)?; + let tenant_streams = TcpListener::bind(TENANT_LISTENER_ADDR)?; + + let curve = EcGroup::new(EcGroupId::SecP256R1)?; + + // The enclave generates an EC key pair. The public key will be inserted into the ReportData + // field of the enclave's attestation Report, which will be transmitted to the tenant. + let mut entropy = Rdseed; + let mut rng = CtrDrbg::new(&mut entropy, None)?; + let mut ec_key = Pk::generate_ec(&mut rng, curve.clone())?; + if !Pk::check_pair(&ec_key, &ec_key) { + panic!("Error generating EC key") + }; + let ec_pub = ec_key.ec_public()?; + + // The enclave handles incoming connections from attestation daemon. + //let mut stream = daemon_streams + // .incoming() + // .next() + // .unwrap_or(Err(std::io::ErrorKind::ConnectionReset.into()))?; + + for stream in daemon_streams.incoming() { let mut stream = stream?; // The enclave receives the identity of the Quoting Enclave from the - // attestation daemon, in the form of a (serialized) TargetInfo + // attestation daemon, in the form of a serialized TargetInfo // structure. The TargetInfo contains the measurement and attribute flags // of the Quoting Enclave. - let qe_id: sgx_isa::Targetinfo = serde_json::from_reader(&mut stream)?; + let qe_id: sgx_isa::Targetinfo = from_reader(&mut stream)?; + + // The enclave's public key will be transmitted to the tenant in the ReportData field + // of the enclave's attesation Report. It must be a &[u8; 64]. + // The compressed public key is 33 bytes long and must be extended by 31 bytes. + let mut report_data = ec_pub.to_binary(&curve, true)?; + report_data.extend(&[0u8; 31]); + let report_data = from_slice(&report_data); // The enclave creates a Report attesting its identity, with the Quoting // Enclave (whose identity was just received) as the Report's target. The - // blank ReportData field must be passed in as a &[u8; 64]. - let report = { - let report_data = [0u8; 64]; - Report::for_target(&qe_id, &report_data) - }; + // ReportData field contains the enclave's public key. + let report = Report::for_target(&qe_id, &report_data); // The enclave sends its attestation Report back to the attestation daemon. - serde_json::to_writer(&mut stream, &report)?; + to_writer(&mut stream, &report)?; println!("Successfully sent report to daemon."); + + break; + } + + // The enclave handles each incoming connection from the tenant. These channels between the tenant + // and enclave are established after attestation is verified and all data exchanged between the tenant + // and enclave after public keys are exchanged is encrypted with a shared symmetric key. + for stream in tenant_streams.incoming() { + let mut stream = stream?; + + // The enclave receives and deserializes tenant pub key, ivs and tags for ciphertext values, ciphertext. + let deserializer = Deserializer::from_reader(stream.try_clone().unwrap()); + let mut iterator = deserializer.into_iter::>(); + + let tenant_key = iterator.next().unwrap()?; + let hash_v1 = iterator.next().unwrap()?; + let hash_v2 = iterator.next().unwrap()?; + let iv1 = iterator.next().unwrap()?; + let iv2 = iterator.next().unwrap()?; + let tag1 = iterator.next().unwrap()?; + let tag2 = iterator.next().unwrap()?; + let ciphertext1 = iterator.next().unwrap()?; + let ciphertext2 = iterator.next().unwrap()?; + + // The enclave generates a shared secret with the tenant. A SHA256 hash of this shared secret + // is used as the symmetric key for encryption and decryption of data. + let tenant_pubkey_ecpoint = EcPoint::from_binary(&curve, &tenant_key)?; + let tenant_pubkey = Pk::public_from_ec_components(curve.clone(), tenant_pubkey_ecpoint)?; + + // TODO: Should this use the same rng as before or create a new one? + let mut shared_secret = [0u8; 32]; // 256 / 8 + ec_key.agree(&tenant_pubkey, &mut shared_secret, &mut rng)?; + let mut symm_key = [0u8; 32]; + Md::hash(Sha256, &shared_secret, &mut symm_key)?; + + // These cipher instances are used for decryption operations and one encryption operation. + // TODO: Can the same cipher instance be used for these? Cipher doesn't implement clone(). + let decrypt_cipher_1 = new_aes256gcm_decrypt_cipher(&symm_key, &iv1)?; + let decrypt_cipher_2 = new_aes256gcm_decrypt_cipher(&symm_key, &iv2)?; + + let mut entropy = Rdseed; + let mut rng = CtrDrbg::new(&mut entropy, None)?; + let mut iv = [0u8; 16]; + rng.random(&mut iv)?; + let encrypt_cipher = new_aes256gcm_encrypt_cipher(&symm_key, &iv)?; + + // The values received from the tenant are decrypted. + let mut plaintext1 = [0u8; 32]; + let mut plaintext2 = [0u8; 32]; + let _ = decrypt_cipher_1.decrypt_auth(&hash_v1, &ciphertext1, &mut plaintext1, &tag1)?; + let _ = decrypt_cipher_2.decrypt_auth(&hash_v2, &ciphertext2, &mut plaintext2, &tag2)?; + + // The values received from the tenant are converted back to 32-bit unsigned ints. + let num1 = Cursor::new(plaintext1).read_u32::()?; + let num2 = Cursor::new(plaintext2).read_u32::()?; + + // The sum of the two plaintext values is calculated. + let sum: u32 = num1 + num2; + println!("\n{} + {} = {}", num1, num2, sum); + + // The sum is converted from u32 to bytes to serve as input for the encryption function. + // The extra 5th byte is in case of overflow. + let mut sum_as_bytes = [0u8; 5]; + NativeEndian::write_u32(&mut sum_as_bytes, sum); + + // The sum is encrypted. + let mut ciphersum = [0u8; 5]; + let mut tag = [0u8; 16]; + let mut hash_of_sum = [0u8; 32]; + Md::hash(Sha256, &sum_as_bytes, &mut hash_of_sum)?; + let _ = + encrypt_cipher.encrypt_auth(&hash_of_sum, &sum_as_bytes, &mut ciphersum, &mut tag)?; + + // The tag, iv, additional data, and encrypted sum are sent back to the tenant. + to_writer(&mut stream, &tag)?; + to_writer(&mut stream, &iv)?; + to_writer(&mut stream, &hash_of_sum)?; + to_writer(&mut stream, &ciphersum)?; + + // TODO: This line exits the program after one run. Otherwise, it appears as though the tenant can be run + // again, but instead the program just hangs the second time. Why? + break; } Ok(()) diff --git a/intel-sgx/attestation-tenant/Cargo.toml b/intel-sgx/attestation-tenant/Cargo.toml index 028d9d2..8861a10 100644 --- a/intel-sgx/attestation-tenant/Cargo.toml +++ b/intel-sgx/attestation-tenant/Cargo.toml @@ -7,7 +7,15 @@ edition = "2018" [dependencies] sgx-isa = { version = "0.3.0" } dcap-ql = "0.2.0" +failure = "0.1" openssl = "0.10.23" -hex = "0.3.1" -failure = "0.1.5" bufstream = "0.1.4" +serde_json = "1.0" +byteorder = "1" + +[dependencies.mbedtls] +git = "https://github.com/haraldh/rust-mbedtls" +branch = "upstream_bindgen" +package = "mbedtls" +default-features = false +features = ["rdrand", "sgx"] diff --git a/intel-sgx/attestation-tenant/src/cert_chain.rs b/intel-sgx/attestation-tenant/src/cert_chain.rs index 018b76a..c6f9851 100644 --- a/intel-sgx/attestation-tenant/src/cert_chain.rs +++ b/intel-sgx/attestation-tenant/src/cert_chain.rs @@ -54,7 +54,6 @@ impl CertChain { panic!("Invalid issuer relationship in certificate chain."); } } - println!("Issuer relationships in PCK cert chain are valid..."); Ok(()) } @@ -85,7 +84,6 @@ impl CertChain { // verified. context.init(&store, &self.leaf, &chain, |c| c.verify_cert())?; - println!("Signatures on certificate chain are valid..."); Ok(()) } } diff --git a/intel-sgx/attestation-tenant/src/key.rs b/intel-sgx/attestation-tenant/src/key.rs index c29899b..40e45a0 100644 --- a/intel-sgx/attestation-tenant/src/key.rs +++ b/intel-sgx/attestation-tenant/src/key.rs @@ -1,9 +1,10 @@ use openssl::{ bn::BigNum, + derive::Deriver, ec::{EcGroup, EcKey}, hash::MessageDigest, nid::Nid, - pkey::{PKey, Public}, + pkey::{PKey, Private, Public}, sha, sign::Verifier, }; @@ -27,37 +28,114 @@ impl Display for HashError { } } -/// This is a wrapper for an openssl::PKey value that adds methods to create -/// the key from raw x and y coordinates and verify a signature and SHA256 hash. +/// This Key is a wrapper for an openssl::PKey and openssl::EcKey key pair +/// with extra functionality, ex. the PKey can be created from raw x and y coordinates and verify +/// a signature and SHA256 hash. The curve for all keys is SECP256R1 (known as PRIME256V1). pub struct Key { - pkey: PKey, + curve: EcGroup, + pubkey: PKey, + privkey: Option>, } impl Key { - /// This creates a new Key from raw x and y coordinates for the SECP256R1 curve. + /// This creates a new public PKey from raw x and y coordinates for the SECP256R1 curve. + /// The private key is not known or needed. pub fn new_from_xy(xy_coords: &[u8]) -> Result> { - let group = EcGroup::from_curve_name(Nid::X9_62_PRIME256V1)?; + // TODO: Is it possible to give the Key a reference to this curve without instantiating it in each + // Key instance? Rust doesn't do runtime-generated global variables. + let curve = EcGroup::from_curve_name(Nid::X9_62_PRIME256V1)?; let mut x: [u8; 32] = Default::default(); let mut y: [u8; 32] = Default::default(); x.copy_from_slice(&xy_coords[0..32]); y.copy_from_slice(&xy_coords[32..64]); let xbn = BigNum::from_slice(&x)?; let ybn = BigNum::from_slice(&y)?; - let ec_key = EcKey::from_public_key_affine_coordinates(&group, &xbn, &ybn)?; + let ec_key = EcKey::from_public_key_affine_coordinates(&curve, &xbn, &ybn)?; let pkey = PKey::from_ec_key(ec_key)?; - Ok(Key { pkey: pkey }) + Ok(Key { + curve: curve, + pubkey: pkey, + privkey: None, + }) + } + + /// This creates a new public PKey from bytes. This can reconstruct a public key sent + /// from an enclave, which uses mbedtls rather than openssl. + pub fn new_from_bytes(bytes: &[u8]) -> Result> { + let mut ctx = openssl::bn::BigNumContext::new()?; + let curve = EcGroup::from_curve_name(Nid::X9_62_PRIME256V1)?; + let pub_ecpoint = openssl::ec::EcPoint::from_bytes(curve.as_ref(), &bytes, &mut *ctx)?; + let pub_eckey = openssl::ec::EcKey::from_public_key(curve.as_ref(), pub_ecpoint.as_ref())?; + let pub_pkey = openssl::pkey::PKey::from_ec_key(pub_eckey)?; + + Ok(Key { + curve: curve, + pubkey: pub_pkey, + privkey: None, + }) } /// This creates a new Key from existing PKey value. pub fn new_from_pubkey(pkey: PKey) -> Self { - Key { pkey: pkey } + Key { + curve: EcGroup::from_curve_name(Nid::X9_62_PRIME256V1).unwrap(), + pubkey: pkey, + privkey: None, + } + } + + /// This creates a new elliptic curve key pair for the SECP256R1 curve with no other inputs. + /// These are then converted to PKeys, which can be used for a DH key exchange according to + /// https://github.com/sfackler/rust-openssl/blob/master/openssl/src/pkey.rs#L16. The EcKey type + /// as the private key allows the public key to be returned as bytes in return_pubkey_bytes(). + // TODO: Is this a good curve to use for ECDH keys? + pub fn new_pair_secp256r1() -> Result> { + let curve = EcGroup::from_curve_name(Nid::X9_62_PRIME256V1)?; + let eckey_priv = EcKey::generate(&curve)?; + eckey_priv.check_key()?; + let eckey_pub = EcKey::from_public_key(&curve, eckey_priv.as_ref().public_key())?; + let pkey_pub = PKey::from_ec_key(eckey_pub)?; + Ok(Key { + curve: curve, + pubkey: pkey_pub, + privkey: Some(eckey_priv), + }) + } + + /// Returns the Key's public key as a PKey + pub fn return_pubkey(&self) -> &PKey { + &self.pubkey + } + + /// Returns the Key's public key as bytes. This is useful for transmitting to the enclave, which + /// can reconstruct the key with mbedtls. + pub fn return_pubkey_bytes(&self) -> Result, Box> { + let mut new_ctx = openssl::bn::BigNumContext::new()?; + let priv_key = self.privkey.as_ref().unwrap(); + + let tenant_pubkey_bytes = priv_key.public_key().to_bytes( + &self.curve, + openssl::ec::PointConversionForm::UNCOMPRESSED, + &mut *new_ctx, + )?; + + Ok(tenant_pubkey_bytes) + } + + /// DHKE deriving shared secret between self's private key and peer's public key. + pub fn derive_shared_secret(&self, peer_key: &PKey) -> Result, Box> { + let ec_priv_key = self.privkey.as_ref().unwrap(); + let pkey_priv_key = PKey::from_ec_key(ec_priv_key.clone())?; + let mut deriver = Deriver::new(pkey_priv_key.as_ref())?; + deriver.set_peer(peer_key)?; + Ok(deriver.derive_to_vec()?) } /// Given a signature and material that was signed with the Key's PKey value, this /// verifies the given signature. pub fn verify_sig(&self, signed: &[u8], sig: &Vec) -> Result<(), Box> { - let mut verifier = Verifier::new(MessageDigest::sha256(), &self.pkey)?; + let mut verifier = Verifier::new(MessageDigest::sha256(), &self.pubkey)?; verifier.update(signed)?; verifier.verify(sig)?; Ok(()) diff --git a/intel-sgx/attestation-tenant/src/main.rs b/intel-sgx/attestation-tenant/src/main.rs index dd5e628..aadc593 100644 --- a/intel-sgx/attestation-tenant/src/main.rs +++ b/intel-sgx/attestation-tenant/src/main.rs @@ -2,21 +2,19 @@ mod cert_chain; mod key; mod sig; -use bufstream::BufStream; +use byteorder::{ByteOrder, NativeEndian, ReadBytesExt}; use dcap_ql::quote::{Qe3CertDataPckCertChain, Quote3SignatureEcdsaP256}; -use openssl::x509::*; -use std::{ - borrow::Borrow, - convert::TryFrom, - env, - error::Error, - fs, - io::{Read, Write}, - iter::Iterator, - net::TcpStream, +use openssl::{ + rand::rand_bytes, + sha::sha256, + symm::{decrypt_aead, encrypt_aead, Cipher}, + x509::*, }; +use serde_json::{from_reader, to_writer, Deserializer}; +use std::{borrow::Borrow, convert::TryFrom, env, error::Error, fs, io::Cursor, net::TcpStream}; const DAEMON_CONN: &'static str = "localhost:1034"; +const ENCL_CONN: &'static str = "localhost:1066"; /// The tenant requests attestation of an enclave from the platform's attestation daemon, and /// receives a Quote from the daemon. The Quote verifies the enclave's measurement. The tenant @@ -42,16 +40,24 @@ fn main() -> Result<(), Box> { let cert_chain_file_contents = fs::read_to_string(&cert_chain_file[..]).expect("PCK cert chain file path invalid."); + // These arguments are supplied by the tenant. They are the data that will be transmitted to the enclave. + let val1 = env::args() + .nth(2) + .expect("You must supply two integers.") + .parse::()?; + let val2 = env::args() + .nth(3) + .expect("You must supply two integers.") + .parse::()?; + // The tenant requests attestation from the platform's attestation daemon. - // The actual signal is arbitrary. - let daemon_conn = TcpStream::connect(DAEMON_CONN)?; - let mut daemon_buf = BufStream::new(daemon_conn); - daemon_buf.write(&b"Request attestation"[..])?; + let mut daemon_conn = TcpStream::connect(DAEMON_CONN)?; + to_writer(&mut daemon_conn, &b"Request attestation"[..])?; // The tenant receives a Quote from the platform's attestation // daemon. This Quote verifies the enclave's self-measurement from its Report. - let mut quote = Vec::new(); - daemon_buf.read_to_end(&mut quote)?; + let quote: Vec = from_reader(&mut daemon_conn)?; + println!("CLIENT < SERVER: Quote (Attestation)"); // The signed material for the Quoting Enclave's Attestation Key (Quote Header || // ISV Enclave Report) is retrieved. @@ -62,6 +68,7 @@ fn main() -> Result<(), Box> { // This parses the Quote's signature section. let quote = dcap_ql::quote::Quote::parse("e)?; + let enclave_report = quote.report_body(); let q_sig = quote.signature::()?; let q_enclave_report_sig = q_sig.signature(); let q_qe_report = q_sig.qe3_report(); @@ -80,18 +87,17 @@ fn main() -> Result<(), Box> { "e_pck_leaf_cert, ); cert_chain.len_ok()?; - println!("Tenant's PCK cert chain loaded..."); // The PCK certificate chain's issuers and signatures are verified. cert_chain.verify_issuers()?; cert_chain.verify_sigs()?; - println!("PCK cert chain verified..."); + println!("CLIENT: PCK cert chain OK"); // The Attestation Key's signature on the Quote is verified. let attestation_key = key::Key::new_from_xy(&q_att_key_pub)?; let quote_signature = sig::Signature::try_from(q_enclave_report_sig)?.to_der_vec()?; attestation_key.verify_sig(&att_key_signed_material, "e_signature)?; - println!("AK signature on Quote header || report body is valid..."); + println!("CLIENT: Quote signature OK"); // The PCK's signature on the Attestation Public Key is verified. let pc_key = key::Key::new_from_pubkey(quote_pck_leaf_cert.public_key()?); @@ -99,7 +105,7 @@ fn main() -> Result<(), Box> { pc_key .borrow() .verify_sig(&q_qe_report, &qe_report_signature)?; - println!("PCK signature on AK is valid..."); + println!("CLIENT: Attestation Key signature OK"); // This verifies that the hashed material signed by the PCK is correct. let mut unhashed_data = Vec::new(); @@ -108,8 +114,95 @@ fn main() -> Result<(), Box> { pc_key .borrow() .verify_hash(hashed_reportdata, unhashed_data)?; - println!("QE Report's hash is valid...."); + println!("CLIENT: Enclave report hash OK"); + + println!("\nCLIENT: Attestation Complete"); + + // The ECDH key exchange between the tenant and the enclave establishes a secure communication channel + // between them in order to send (code and) data to the enclave securely after attestation. + + // TODO: add report parsing to Fortanix dcap-ql/quote.rs + // The compressed EC key is 33 bytes long. + let peer_pub_pkey = key::Key::new_from_bytes(&enclave_report[320..353])?; + + // The tenant generates its EC key pair. + let tenant_eckey_pair = key::Key::new_pair_secp256r1()?; + let tenant_pubkey_bytes = tenant_eckey_pair.return_pubkey_bytes()?; + + // The tenant derives a shared secret using its private key and the enclave's public key, then hashes + // this shared secret to created a symmetric key used for encrypting and decrypting communication with + // the enclave. + let shared_secret = tenant_eckey_pair.derive_shared_secret(&peer_pub_pkey.return_pubkey())?; + let symm_key = sha256(&shared_secret); + + let mut iv1 = [0u8; 16]; + rand_bytes(&mut iv1)?; + let mut iv2 = [0u8; 16]; + rand_bytes(&mut iv2)?; + + // The user data is converted from u32 to bytes to be input to the encryption function. + let mut val1_as_bytes = [0u8; 4]; + NativeEndian::write_u32(&mut val1_as_bytes, val1); + let mut val2_as_bytes = [0u8; 4]; + NativeEndian::write_u32(&mut val2_as_bytes, val2); + + // The user data is encrypted with AES 256 GCM. + let hash_of_val1 = sha256(&val1_as_bytes); + let hash_of_val2 = sha256(&val2_as_bytes); + let mut tag1 = [0; 16]; + let mut tag2 = [0; 16]; + let ciphertext1 = encrypt_aead( + Cipher::aes_256_gcm(), + &symm_key, + Some(&iv1), + &hash_of_val1, + &val1_as_bytes, + &mut tag1, + )?; + let ciphertext2 = encrypt_aead( + Cipher::aes_256_gcm(), + &symm_key, + Some(&iv2), + &hash_of_val2, + &val2_as_bytes, + &mut tag2, + )?; + + // The tenant sends its pub key and encrypted data to the enclave, along with the ivs, tags, and additional + // data for the ciphertext. + let mut encl_conn = TcpStream::connect(ENCL_CONN)?; + to_writer(&mut encl_conn, &tenant_pubkey_bytes)?; + to_writer(&mut encl_conn, &hash_of_val1)?; + to_writer(&mut encl_conn, &hash_of_val2)?; + to_writer(&mut encl_conn, &iv1)?; + to_writer(&mut encl_conn, &iv2)?; + to_writer(&mut encl_conn, &tag1)?; + to_writer(&mut encl_conn, &tag2)?; + to_writer(&mut encl_conn, &ciphertext1)?; + to_writer(&mut encl_conn, &ciphertext2)?; + println!("CLIENT > SERVER: Tenant PubKey and Encrypted Data"); + + // The tenant receives the tag, iv, additional data, and encrypted sum from the enclave. + let deserializer = Deserializer::from_reader(&mut encl_conn); + let mut iterator = deserializer.into_iter::>(); + let tag = iterator.next().unwrap()?; + let iv = iterator.next().unwrap()?; + let ad = iterator.next().unwrap()?; + let ciphersum = iterator.next().unwrap()?; + + // The sum is decrypted and converted back to a u32. + let sum = decrypt_aead( + Cipher::aes_256_gcm(), + &symm_key, + Some(&iv), + &ad, + &ciphersum, + &tag, + )?; + let mut reader = Cursor::new(sum); + let sum = reader.read_u32::()?; + + println!("\n{:?}", sum); - println!("\nQuote verified."); Ok(()) }