This is an automated email from the ASF dual-hosted git repository. hsun pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/incubator-teaclave.git
commit c66a8e2ef67998f268961fc98f3634965a318376 Author: GeminiCarrie <[email protected]> AuthorDate: Thu Apr 6 10:41:33 2023 +0000 Add the execution service running in the LibOS --- CMakeLists.txt | 20 + attestation/Cargo.toml | 20 +- attestation/src/attestation.rs | 1 + attestation/src/cert.rs | 2 +- attestation/src/key.rs | 1 + attestation/src/lib.rs | 2 +- .../src/platform/libos/mod.rs | 19 +- attestation/src/platform/libos/occlum.rs | 150 ++++ rpc/src/lib.rs => attestation/src/platform/mod.rs | 40 +- attestation/src/{platform.rs => platform/sgx.rs} | 6 +- attestation/src/service.rs | 27 +- cmake/TeaclaveUtils.cmake | 5 +- cmake/tomls/Cargo.sgx_trusted_lib.lock | 826 ++++++++++++++++++- cmake/tomls/Cargo.sgx_untrusted_app.lock | 893 +++++++++++++++++++-- cmake/tomls/Cargo.sgx_untrusted_app.toml | 7 + cmake/tomls/Cargo.unix_app.lock | 2 + executor/Cargo.toml | 7 + executor/context/Cargo.toml | 5 + executor/context/src/context.rs | 1 - executor/src/lib.rs | 6 +- file_agent/src/agent.rs | 3 +- file_agent/src/lib.rs | 2 +- function/Cargo.toml | 6 + logger/Cargo.toml | 2 +- rpc/Cargo.toml | 6 + rpc/src/lib.rs | 2 +- rpc/src/server.rs | 4 + runtime/Cargo.toml | 3 + runtime/src/raw_io.rs | 4 +- services/authentication/enclave/src/user_db.rs | 3 +- services/execution/app/Cargo.toml | 16 +- services/execution/app/build.rs | 26 +- services/execution/app/src/main.rs | 32 +- services/execution/enclave/Cargo.toml | 15 +- services/execution/enclave/src/ecall.rs | 55 ++ .../enclave/src/{ocall.rs => file_handler.rs} | 16 +- services/execution/enclave/src/lib.rs | 55 +- .../execution/enclave/src/task_file_manager.rs | 13 +- services/proto/Cargo.toml | 5 + services/storage/enclave/src/lib.rs | 3 +- services/utils/service_enclave_utils/Cargo.toml | 5 + services/utils/service_enclave_utils/src/lib.rs | 17 +- worker/Cargo.toml | 5 + worker/src/worker.rs | 3 +- 44 files changed, 2104 insertions(+), 237 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 818de3e7..59b01f52 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -347,3 +347,23 @@ add_cargo_build_dylib_staticlib_target(teaclave_client_sdk # ${TEACLAVE_EXAMPLE_INSTALL_DIR}/quickstart_c ) add_enclave_sig_target_n_hooks() + +set(LIBOS_EXTRA_CARGO_FLAGS --features "libos") +set(LIBOS_DEPENDS prep) +if(EXECUTOR_WAMR) + list(APPEND LIBOS_DEPENDS wamr) +endif() +add_cargo_build_target( + teaclave_execution_service + TARGET_NAME + "teaclave_execution_service_libos" + TOML_DIR + ${MT_SGXAPP_TOML_DIR} + TARGET_DIR + ${UNTRUSTED_TARGET_DIR} + INSTALL_DIR + ${TEACLAVE_BIN_INSTALL_DIR}/teaclave_execution_service_libos + EXTRA_CARGO_FLAGS + ${LIBOS_EXTRA_CARGO_FLAGS} + DEPENDS + ${LIBOS_DEPENDS}) \ No newline at end of file diff --git a/attestation/Cargo.toml b/attestation/Cargo.toml index 955064e1..df7d3728 100644 --- a/attestation/Cargo.toml +++ b/attestation/Cargo.toml @@ -25,14 +25,25 @@ edition = "2021" [features] default = [] +app = [ + "teaclave_types/app", + "sgx_crypto/ucrypto", + "teaclave_config/build_config" +] mesalock_sgx = [ - "sgx_crypto", + "sgx_crypto/tcrypto", "sgx_rand/trand", "sgx_tse", "teaclave_types/mesalock_sgx", "teaclave_config/mesalock_sgx", "teaclave_config/build_config", ] +libos = [ + "app", + "libc", + "sgx_rand/urand", +] + enclave_unit_test = ["teaclave_test_utils/mesalock_sgx"] [dependencies] @@ -43,6 +54,7 @@ cfg-if = { version = "0.1.9" } chrono = { version = "0.4.6", default-features = false } hex = { version = "0.4.0" } httparse = { version = "1.3.2", default-features = false } +libc = { version = "0.2.66", optional = true } log = { version = "0.4.17", features = ["release_max_level_info"] } num-bigint = { version = "0.2.2" } percent-encoding = { version = "2.1.0" } @@ -60,9 +72,9 @@ teaclave_types = { path = "../types" } teaclave_config = { path = "../config" } teaclave_test_utils = { path = "../tests/utils", optional = true } -sgx_rand = { version = "2.0.0", optional = true } -sgx_crypto = { version = "2.0.0", optional = true } -sgx_tse = { version = "2.0.0", optional = true } +sgx_crypto = { version = "2.0.0", optional = true, default-features = false} +sgx_tse = { version = "2.0.0", features = ["capi"], optional = true } +sgx_rand = { version = "2.0.0", default-features = false, optional = true } [target.'cfg(not(target_vendor = "teaclave"))'.dependencies] sgx_types = { version = "2.0.0" } diff --git a/attestation/src/attestation.rs b/attestation/src/attestation.rs index 14aa3020..0f8cace5 100644 --- a/attestation/src/attestation.rs +++ b/attestation/src/attestation.rs @@ -26,6 +26,7 @@ use std::sync::{Arc, RwLock}; use std::thread; use std::time::{Duration, SystemTime}; #[allow(unused_imports)] +#[cfg(feature = "mesalock_sgx")] use std::untrusted::time::SystemTimeEx; use anyhow::{anyhow, Result}; diff --git a/attestation/src/cert.rs b/attestation/src/cert.rs index 084ea444..6e547afb 100644 --- a/attestation/src/cert.rs +++ b/attestation/src/cert.rs @@ -350,7 +350,7 @@ macro_rules! asn1_set_ty { }; } -#[cfg(feature = "mesalock_sgx")] +#[cfg(any(feature = "mesalock_sgx", feature = "libos"))] macro_rules! asn1_seq { () => { () }; ($e: expr) => { diff --git a/attestation/src/key.rs b/attestation/src/key.rs index 03e3ba1f..8388936c 100644 --- a/attestation/src/key.rs +++ b/attestation/src/key.rs @@ -96,6 +96,7 @@ impl NistP256KeyPair { use std::time::SystemTime; use std::time::UNIX_EPOCH; #[allow(unused_imports)] + #[cfg(feature = "mesalock_sgx")] use std::untrusted::time::SystemTimeEx; use yasna::construct_der; use yasna::models::{ObjectIdentifier, UTCTime}; diff --git a/attestation/src/lib.rs b/attestation/src/lib.rs index 1c2a537f..497c0434 100644 --- a/attestation/src/lib.rs +++ b/attestation/src/lib.rs @@ -160,7 +160,7 @@ pub mod report; pub mod verifier; cfg_if::cfg_if! { - if #[cfg(feature = "mesalock_sgx")] { + if #[cfg(any(feature = "mesalock_sgx", feature = "libos"))] { mod service; pub mod key; mod platform; diff --git a/services/execution/app/src/main.rs b/attestation/src/platform/libos/mod.rs similarity index 70% copy from services/execution/app/src/main.rs copy to attestation/src/platform/libos/mod.rs index 4482860f..31922826 100644 --- a/services/execution/app/src/main.rs +++ b/attestation/src/platform/libos/mod.rs @@ -15,14 +15,15 @@ // specific language governing permissions and limitations // under the License. -use anyhow::Result; -use teaclave_service_app_utils::launch_teaclave_service; +pub(crate) mod occlum; +// TODO gramine or other LibOS -// Use to import ocall -pub use teaclave_file_agent::ocall_handle_file_request; - -const PACKAGE_NAME: &str = env!("CARGO_PKG_NAME"); - -fn main() -> Result<()> { - launch_teaclave_service(PACKAGE_NAME) +#[derive(thiserror::Error, Debug)] +pub enum PlatformError { + #[error("Failed to call {0}: {1}")] + Ioctl(String, i32), + #[error("Failed to get quote: {0}")] + GetQuote(String), + #[error("Failed to use SGX rng to generate random number: {0}")] + RngError(std::io::Error), } diff --git a/attestation/src/platform/libos/occlum.rs b/attestation/src/platform/libos/occlum.rs new file mode 100644 index 00000000..4f6fae74 --- /dev/null +++ b/attestation/src/platform/libos/occlum.rs @@ -0,0 +1,150 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +// Depend on occlum(https://github.com/occlum/occlum.git) + +use super::super::{PlatformError, Result}; +use libc::*; +use log::debug; +use sgx_crypto::ecc::EcPublicKey; +use sgx_rand::{RdRand, Rng}; +use sgx_types::types::*; +use std::ffi::CString; + +// From occlum/src/libos/src/fs/dev_fs/dev_sgx/consts.rs. +const SGX_CMD_NUM_GEN_EPID_QUOTE: u64 = (2u32 + | ('s' as u32) << 8 + | (std::mem::size_of::<IoctlGenEPIDQuoteArg>() as u32) << 16 + | 3u32 << 30) as u64; +// for dcap +const IOCTL_MAX_RETRIES: u32 = 20; +const SGXIOC_GET_DCAP_QUOTE_SIZE: u64 = 0x80047307; +const SGXIOC_GEN_DCAP_QUOTE: u64 = 0xc0187308; + +// From occlum/src/libos/src/fs/dev_fs/dev_sgx/mod.rs +#[repr(C)] +pub struct IoctlGenDCAPQuoteArg { + pub report_data: *const ReportData, // Input + pub quote_size: *mut u32, // Input/output + pub quote_buf: *mut u8, // Output +} + +// From occlum/src/libos/src/fs/dev_fs/dev_sgx/mod.rs +#[repr(C)] +struct IoctlGenEPIDQuoteArg { + report_data: ReportData, // Input + quote_type: QuoteSignType, // Input + spid: Spid, // Input + nonce: QuoteNonce, // Input + sigrl_ptr: *const u8, // Input (optional) + sigrl_len: u32, // Input (optional) + quote_buf_len: u32, // Input + quote_buf: *mut u8, // Output +} + +fn get_dev_fd() -> libc::c_int { + let path = CString::new("/dev/sgx").unwrap(); + let fd = unsafe { libc::open(path.as_ptr(), O_RDONLY) }; + if fd > 0 { + fd + } else { + panic!("Open /dev/sgx failed") + } +} + +/// Create report data. +pub(crate) fn create_sgx_report_data(pub_k: EcPublicKey) -> ReportData { + debug!("create_sgx_report_data"); + let mut report_data: ReportData = ReportData::default(); + let mut pub_k_gx = pub_k.public_key().gx; + pub_k_gx.reverse(); + let mut pub_k_gy = pub_k.public_key().gy; + pub_k_gy.reverse(); + report_data.d[..32].clone_from_slice(&pub_k_gx); + report_data.d[32..].clone_from_slice(&pub_k_gy); + report_data +} + +macro_rules! do_ioctl { + ($cmd:expr,$arg:expr) => { + let mut retries = 0; + let mut ret = -1; + let fd = get_dev_fd(); + log::debug!("begin do_ioctl {}", stringify!($cmd)); + while retries < IOCTL_MAX_RETRIES { + ret = unsafe { libc::ioctl(fd, $cmd, $arg) }; + if ret == 0 { + break; + // EBUSY 16 + } + std::thread::sleep(std::time::Duration::from_secs(2)); + retries += 1; + } + if retries == IOCTL_MAX_RETRIES { + return Err(PlatformError::Ioctl(stringify!($cmd).to_string(), ret)); + } + }; +} + +/// Get quote with attestation key ID and enclave's local report. +pub(crate) fn get_sgx_epid_quote(spid: &Spid, report_data: ReportData) -> Result<Vec<u8>> { + let sigrl_ptr: *const u8 = std::ptr::null(); + let quote_len: u32 = 4096; + let mut quote = vec![0u8; quote_len as usize]; + let mut qe_report_info = QeReportInfo::default(); + let mut quote_nonce = QuoteNonce::default(); + + let mut rng = RdRand::new().map_err(PlatformError::RngError)?; + rng.fill_bytes(&mut quote_nonce.rand); + qe_report_info.nonce = quote_nonce; + + debug!("SGX_CMD_NUM_GEN_EPID_QUOTE"); + let mut quote_arg = IoctlGenEPIDQuoteArg { + report_data, // Input + quote_type: QuoteSignType::Linkable, // Input + spid: spid.to_owned(), // Input + nonce: quote_nonce, // Input + sigrl_ptr, // Input (optional) + sigrl_len: 0, // Input (optional) + quote_buf_len: quote_len, // Input + quote_buf: quote.as_mut_ptr(), // Output + }; + + // gen quote and check qe_quote and quote nonce + do_ioctl!(SGX_CMD_NUM_GEN_EPID_QUOTE, &mut quote_arg); + let sgx_quote = unsafe { &*(quote.as_ptr() as *const Quote) }; + let quote_size = std::mem::size_of::<Quote>() + sgx_quote.signature_len as usize; + if quote_size > quote.len() { + return Err(PlatformError::GetQuote("wrong quote size".to_string())); + } + let quote_buf = quote[..quote_size].to_vec(); + Ok(quote_buf) +} + +/// Get dcap quote +pub(crate) fn get_sgx_dcap_quote(_spid: &Spid, report_data: ReportData) -> Result<Vec<u8>> { + let mut quote_len: u32 = 0; + do_ioctl!(SGXIOC_GET_DCAP_QUOTE_SIZE, &mut quote_len); + let mut quote_buf = vec![0; quote_len as usize]; + let mut quote_arg: IoctlGenDCAPQuoteArg = IoctlGenDCAPQuoteArg { + report_data: &report_data as _, + quote_size: &mut quote_len, + quote_buf: quote_buf.as_mut_ptr(), + }; + do_ioctl!(SGXIOC_GEN_DCAP_QUOTE, &mut quote_arg); + Ok(quote_buf) +} diff --git a/rpc/src/lib.rs b/attestation/src/platform/mod.rs similarity index 55% copy from rpc/src/lib.rs copy to attestation/src/platform/mod.rs index e396c16c..503f9934 100644 --- a/rpc/src/lib.rs +++ b/attestation/src/platform/mod.rs @@ -15,30 +15,24 @@ // specific language governing permissions and limitations // under the License. +#[cfg(feature = "libos")] +pub(crate) mod libos; +pub(crate) mod sgx; +#[cfg(all(feature = "libos", feature = "mesalock_sgx"))] +compile_error!("feature \"mesalock_sgx\" and feature \"libos\" cannot be enabled at the same time"); + +#[cfg(feature = "libos")] +pub(crate) use libos::{ + occlum::{create_sgx_report_data, get_sgx_dcap_quote, get_sgx_epid_quote}, + PlatformError, +}; #[cfg(feature = "mesalock_sgx")] -extern crate sgx_trts; +pub(crate) use sgx::{create_sgx_isv_enclave_report, get_sgx_quote, init_sgx_quote, PlatformError}; -use serde::{Deserialize, Serialize}; -use teaclave_types::TeaclaveServiceResponseError; +type Result<T> = std::result::Result<T, PlatformError>; -pub trait TeaclaveService<V, U> -where - U: Serialize + std::fmt::Debug, - V: for<'de> Deserialize<'de> + std::fmt::Debug, -{ - fn handle_request( - &self, - request: Request<V>, - ) -> std::result::Result<U, TeaclaveServiceResponseError>; +#[cfg(all(feature = "enclave_unit_test", feature = "mesalock_sgx"))] +pub mod tests { + use super::*; + pub use sgx::tests::*; } - -pub mod channel; -pub mod config; -pub mod endpoint; -mod protocol; -mod request; -pub use request::{IntoRequest, Request}; -pub use teaclave_rpc_proc_macro::into_request; -#[cfg(feature = "mesalock_sgx")] -pub mod server; -mod transport; diff --git a/attestation/src/platform.rs b/attestation/src/platform/sgx.rs similarity index 99% rename from attestation/src/platform.rs rename to attestation/src/platform/sgx.rs index 94e2c65d..d3005bd1 100644 --- a/attestation/src/platform.rs +++ b/attestation/src/platform/sgx.rs @@ -17,7 +17,9 @@ //! This module provides SGX platform related functions like getting local //! report and transform into a remotely verifiable quote. +#![cfg(feature = "mesalock_sgx")] +use super::Result; use log::debug; use sgx_crypto::ecc::EcPublicKey; use sgx_crypto::sha::Sha256; @@ -26,10 +28,8 @@ use sgx_tse::{EnclaveReport, EnclaveTarget}; use sgx_types::error::SgxStatus; use sgx_types::error::SgxStatus::Success; use sgx_types::types::*; - -type Result<T> = std::result::Result<T, PlatformError>; - #[derive(thiserror::Error, Debug)] + pub enum PlatformError { #[error("Failed to call {0}: {1}")] OCallError(String, SgxStatus), diff --git a/attestation/src/service.rs b/attestation/src/service.rs index 6b6cdc7e..b69be8ec 100644 --- a/attestation/src/service.rs +++ b/attestation/src/service.rs @@ -32,7 +32,6 @@ use anyhow::{anyhow, bail, Result}; use log::{debug, trace, warn}; use serde_json::json; use sgx_crypto::ecc::EcPublicKey; -use sgx_types::types::QlAttKeyId; /// Root certification of the DCAP attestation service provider. #[cfg(dcap)] @@ -70,6 +69,7 @@ pub(crate) enum AttestationServiceError { Unknown, } +#[cfg(all(feature = "mesalock_sgx", not(feature = "libos")))] impl EndorsedAttestationReport { pub fn new( att_service_cfg: &AttestationServiceConfig, @@ -79,7 +79,7 @@ impl EndorsedAttestationReport { // For IAS-based attestation, we need to fill our SPID (obtained from Intel) // into the attestation key id. For DCAP-based attestation, SPID should be 0 - const SPID_OFFSET: usize = std::mem::size_of::<QlAttKeyId>(); + const SPID_OFFSET: usize = std::mem::size_of::<sgx_types::types::QlAttKeyId>(); ak_id.att_key_id[SPID_OFFSET..(SPID_OFFSET + att_service_cfg.spid.id.len())] .clone_from_slice(&att_service_cfg.spid.id); @@ -96,6 +96,27 @@ impl EndorsedAttestationReport { } } +#[cfg(all(feature = "libos", not(feature = "mesalock_sgx")))] +impl EndorsedAttestationReport { + pub fn new(att_service_cfg: &AttestationServiceConfig, pub_k: EcPublicKey) -> Result<Self> { + let report_data = platform::create_sgx_report_data(pub_k); + let quote = match &att_service_cfg.algo { + crate::AttestationAlgorithm::SgxEpid => { + platform::get_sgx_epid_quote(&att_service_cfg.spid, report_data)? + } + crate::AttestationAlgorithm::SgxEcdsa => { + platform::get_sgx_dcap_quote(&att_service_cfg.spid, report_data)? + } + }; + crate::service::get_report( + &att_service_cfg.algo, + &att_service_cfg.as_url, + &att_service_cfg.api_key, + "e, + ) + } +} + fn new_tls_stream(url: &url::Url) -> Result<rustls::StreamOwned<rustls::ClientSession, TcpStream>> { let host_str = url .host_str() @@ -123,7 +144,7 @@ fn new_tls_stream(url: &url::Url) -> Result<rustls::StreamOwned<rustls::ClientSe /// Get attestation report form the attestation service (e.g., Intel Attestation /// Service and customized DCAP attestation service). -fn get_report( +pub(crate) fn get_report( algo: &AttestationAlgorithm, url: &url::Url, api_key: &str, diff --git a/cmake/TeaclaveUtils.cmake b/cmake/TeaclaveUtils.cmake index 0195a846..6adb3772 100644 --- a/cmake/TeaclaveUtils.cmake +++ b/cmake/TeaclaveUtils.cmake @@ -88,9 +88,8 @@ endmacro() # [NOT_SET_COMMON_ENV] [EXTRA_CARGO_FLAGS flg...] ) function(add_cargo_build_target package_name) set(options NOT_SET_COMMON_ENV) - set(oneValueArgs TARGET_NAME TOML_DIR TARGET_DIR INSTALL_DIR - EXTRA_CARGO_FLAGS) - set(multiValueArgs DEPENDS) + set(oneValueArgs TARGET_NAME TOML_DIR TARGET_DIR INSTALL_DIR) + set(multiValueArgs DEPENDS EXTRA_CARGO_FLAGS) cmake_parse_arguments(MTEE "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) diff --git a/cmake/tomls/Cargo.sgx_trusted_lib.lock b/cmake/tomls/Cargo.sgx_trusted_lib.lock index ade5d7fd..4d679c10 100644 --- a/cmake/tomls/Cargo.sgx_trusted_lib.lock +++ b/cmake/tomls/Cargo.sgx_trusted_lib.lock @@ -41,12 +41,24 @@ version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" +[[package]] +name = "base64" +version = "0.21.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4a4ddaa51a5bc52a6948f74c06d20aaaddb71924eab79b8c97a8c556e942d6a" + [[package]] name = "bit-vec" version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "349f9b6a179ed607305526ca489b34ad0a41aed5f7980fa90eb03160b69598fb" +[[package]] +name = "bitflags" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" + [[package]] name = "bumpalo" version = "3.11.1" @@ -105,6 +117,22 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3d7b894f5411737b7867f4827955924d7c254fc9f4d91a6aad6b097804b1018b" +[[package]] +name = "core-foundation" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "194a7a9e6de53fa55116934067c844d9d749312f75c6f6d0980e8c252f8c2146" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "core-foundation-sys" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5827cebf4670468b8772dd191856768aedcb1b0278a04f989f7766351917b9dc" + [[package]] name = "crc" version = "2.0.0" @@ -116,7 +144,7 @@ version = "0.1.26" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6d2301688392eb071b0bf1a37be05c469d3cc4dbbd95df672fe28ab021e6a096" dependencies = [ - "quote 1.0.23", + "quote 1.0.26", "syn 1.0.107", ] @@ -126,6 +154,15 @@ version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "90e5c1c8368803113bf0c9584fc495a58b86dc8a29edbf8fe877d21d9507e797" +[[package]] +name = "encoding_rs" +version = "0.8.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "071a31f4ee85403370b58aca746f01041ede6f0da2730960ad001edc2b71b394" +dependencies = [ + "cfg-if 1.0.0", +] + [[package]] name = "env_logger" version = "0.9.3" @@ -135,12 +172,57 @@ dependencies = [ "log", ] +[[package]] +name = "errno" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f639046355ee4f37944e44f60642c6f3a7efa3cf6b78c78a0d989a8ce6c396a1" +dependencies = [ + "errno-dragonfly", + "libc", + "winapi", +] + +[[package]] +name = "errno-dragonfly" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf" +dependencies = [ + "cc", + "libc", +] + +[[package]] +name = "fastrand" +version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e51093e27b0797c359783294ca4f0a911c270184cb10f85783b118614a1501be" +dependencies = [ + "instant", +] + [[package]] name = "fnv" version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" +[[package]] +name = "foreign-types" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" +dependencies = [ + "foreign-types-shared", +] + +[[package]] +name = "foreign-types-shared" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" + [[package]] name = "form_urlencoded" version = "1.1.0" @@ -150,6 +232,95 @@ dependencies = [ "percent-encoding", ] +[[package]] +name = "futures" +version = "0.3.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13e2792b0ff0340399d58445b88fd9770e3489eff258a4cbc1523418f12abf84" +dependencies = [ + "futures-channel", + "futures-core", + "futures-executor", + "futures-io", + "futures-sink", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-channel" +version = "0.3.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2e5317663a9089767a1ec00a487df42e0ca174b61b4483213ac24448e4664df5" +dependencies = [ + "futures-core", + "futures-sink", +] + +[[package]] +name = "futures-core" +version = "0.3.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec90ff4d0fe1f57d600049061dc6bb68ed03c7d2fbd697274c41805dcb3f8608" + +[[package]] +name = "futures-executor" +version = "0.3.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e8de0a35a6ab97ec8869e32a2473f4b1324459e14c29275d14b10cb1fd19b50e" +dependencies = [ + "futures-core", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-io" +version = "0.3.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfb8371b6fb2aeb2d280374607aeabfc99d95c72edfe51692e42d3d7f0d08531" + +[[package]] +name = "futures-macro" +version = "0.3.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95a73af87da33b5acf53acfebdc339fe592ecf5357ac7c0a7734ab9d8c876a70" +dependencies = [ + "proc-macro2 1.0.56", + "quote 1.0.26", + "syn 1.0.107", +] + +[[package]] +name = "futures-sink" +version = "0.3.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f310820bb3e8cfd46c80db4d7fb8353e15dfff853a127158425f31e0be6c8364" + +[[package]] +name = "futures-task" +version = "0.3.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dcf79a1bf610b10f42aea489289c5a2c478a786509693b80cd39c44ccd936366" + +[[package]] +name = "futures-util" +version = "0.3.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c1d6de3acfef38d2be4b1f543f553131788603495be83da675e180c8d6b7bd1" +dependencies = [ + "futures-channel", + "futures-core", + "futures-io", + "futures-macro", + "futures-sink", + "futures-task", + "memchr", + "pin-project-lite", + "pin-utils", + "slab", +] + [[package]] name = "gbdt" version = "0.1.1" @@ -171,7 +342,7 @@ dependencies = [ "cfg-if 1.0.0", "libc", "sgx_libc", - "wasi", + "wasi 0.10.2+wasi-snapshot-preview1", ] [[package]] @@ -180,11 +351,36 @@ version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "41973d4c45f7a35af8753ba3457cc99d406d863941fd7f52663cff54a5ab99b3" dependencies = [ - "proc-macro2 1.0.49", - "quote 1.0.23", + "proc-macro2 1.0.56", + "quote 1.0.26", "syn 1.0.107", ] +[[package]] +name = "h2" +version = "0.3.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5be7b54589b581f624f566bf5d8eb2bab1db736c51528720b6bd36b96b55924d" +dependencies = [ + "bytes", + "fnv", + "futures-core", + "futures-sink", + "futures-util", + "http", + "indexmap", + "slab", + "tokio", + "tokio-util", + "tracing", +] + +[[package]] +name = "hashbrown" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" + [[package]] name = "hashbrown_tstd" version = "0.12.0" @@ -215,12 +411,66 @@ dependencies = [ "itoa", ] +[[package]] +name = "http-body" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d5f38f16d184e36f2408a55281cd658ecbd3ca05cce6d6510a176eca393e26d1" +dependencies = [ + "bytes", + "http", + "pin-project-lite", +] + [[package]] name = "httparse" version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904" +[[package]] +name = "httpdate" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4a1e36c821dbe04574f602848a19f742f4fb3c98d40449f11bcad18d6b17421" + +[[package]] +name = "hyper" +version = "0.14.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc5e554ff619822309ffd57d8734d77cd5ce6238bc956f037ea06c58238c9899" +dependencies = [ + "bytes", + "futures-channel", + "futures-core", + "futures-util", + "h2", + "http", + "http-body", + "httparse", + "httpdate", + "itoa", + "pin-project-lite", + "socket2", + "tokio", + "tower-service", + "tracing", + "want", +] + +[[package]] +name = "hyper-tls" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905" +dependencies = [ + "bytes", + "hyper", + "native-tls", + "tokio", + "tokio-native-tls", +] + [[package]] name = "idna" version = "0.3.0" @@ -245,6 +495,25 @@ dependencies = [ "num-traits", ] +[[package]] +name = "indexmap" +version = "1.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1885e79c1fc4b10f0e172c475f458b7f7b93061064d98c3293e98c5ba0c8b399" +dependencies = [ + "autocfg", + "hashbrown", +] + +[[package]] +name = "instant" +version = "0.1.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" +dependencies = [ + "cfg-if 1.0.0", +] + [[package]] name = "integer-encoding" version = "1.1.7" @@ -268,11 +537,27 @@ version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7e41b53715c6f0c4be49510bb82dee2c1e51c8586d885abe65396e82ed518548" dependencies = [ - "proc-macro2 1.0.49", - "quote 1.0.23", + "proc-macro2 1.0.56", + "quote 1.0.26", "syn 1.0.107", ] +[[package]] +name = "io-lifetimes" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cfa919a82ea574332e2de6e74b4c36e74d41982b335080fa59d4ef31be20fdf3" +dependencies = [ + "libc", + "windows-sys 0.45.0", +] + +[[package]] +name = "ipnet" +version = "2.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "30e22bd8629359895450b59ea7a776c850561b96a3b1d31321c1949d9e6c9146" + [[package]] name = "itertools" version = "0.8.2" @@ -344,6 +629,12 @@ version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "348108ab3fba42ec82ff6e9564fc4ca0247bdccdc68dd8af9764bbc79c3c8ffb" +[[package]] +name = "linux-raw-sys" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f051f77a7c8e6957c0696eac88f26b0117e54f52d3fc682ab19397a8812846a4" + [[package]] name = "log" version = "0.4.17" @@ -369,6 +660,42 @@ version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" +[[package]] +name = "mime" +version = "0.3.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a60c7ce501c71e03a9c9c0d35b861413ae925bd979cc7a4e30d060069aaac8d" + +[[package]] +name = "mio" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b9d9a46eff5b4ff64b45a9e316a6d1e0bc719ef429cbec4dc630684212bfdf9" +dependencies = [ + "libc", + "log", + "wasi 0.11.0+wasi-snapshot-preview1", + "windows-sys 0.45.0", +] + +[[package]] +name = "native-tls" +version = "0.2.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07226173c32f2926027b63cce4bcd8076c3552846cbe7925f3aaffeac0a3b92e" +dependencies = [ + "lazy_static", + "libc", + "log", + "openssl", + "openssl-probe", + "openssl-sys", + "schannel", + "security-framework", + "security-framework-sys", + "tempfile", +] + [[package]] name = "num" version = "0.1.42" @@ -483,6 +810,51 @@ version = "1.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "86f0b0d4bf799edbc74508c1e8bf170ff5f41238e5f8225603ca7caaae2b7860" +[[package]] +name = "openssl" +version = "0.10.45" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b102428fd03bc5edf97f62620f7298614c45cedf287c271e7ed450bbaf83f2e1" +dependencies = [ + "bitflags", + "cfg-if 1.0.0", + "foreign-types", + "libc", + "once_cell", + "openssl-macros", + "openssl-sys", +] + +[[package]] +name = "openssl-macros" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b501e44f11665960c7e7fcf062c7d96a14ade4aa98116c004b2e37b5be7d736c" +dependencies = [ + "proc-macro2 1.0.56", + "quote 1.0.26", + "syn 1.0.107", +] + +[[package]] +name = "openssl-probe" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" + +[[package]] +name = "openssl-sys" +version = "0.9.80" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23bbbf7854cd45b83958ebe919f0e8e516793727652e27fda10a8384cfc790b7" +dependencies = [ + "autocfg", + "cc", + "libc", + "pkg-config", + "vcpkg", +] + [[package]] name = "pem" version = "0.8.3" @@ -500,6 +872,24 @@ version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "478c572c3d73181ff3c2539045f6eb99e5491218eae919370993b890cdbdd98e" +[[package]] +name = "pin-project-lite" +version = "0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e0a7ae3ac2f1173085d398531c705756c94a4c56843785df85a60c1a0afac116" + +[[package]] +name = "pin-utils" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" + +[[package]] +name = "pkg-config" +version = "0.3.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ac9a59f73473f1b8d852421e59e64809f025994837ef743615c6d0c5b305160" + [[package]] name = "ppv-lite86" version = "0.2.17" @@ -517,9 +907,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.49" +version = "1.0.56" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57a8eca9f9c4ffde41714334dee777596264c7825420f521abc92b5b5deb63a5" +checksum = "2b63bdb0cd06f1f4dedf69b254734f9b45af66e4a031e42a7480257d9898b435" dependencies = [ "unicode-ident", ] @@ -542,8 +932,8 @@ checksum = "4ea9b0f8cbe5e15a8a042d030bd96668db28ecb567ec37d691971ff5731d2b1b" dependencies = [ "anyhow", "itertools 0.10.5", - "proc-macro2 1.0.49", - "quote 1.0.23", + "proc-macro2 1.0.56", + "quote 1.0.26", "syn 1.0.107", ] @@ -558,11 +948,11 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.23" +version = "1.0.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8856d8364d252a14d474036ea1358d63c9e6965c8e5c1885c18f73d70bff9c7b" +checksum = "4424af4bf778aae2051a77b60283332f386554255d722233d09fbfc7e30da2fc" dependencies = [ - "proc-macro2 1.0.49", + "proc-macro2 1.0.56", ] [[package]] @@ -626,6 +1016,15 @@ dependencies = [ "rand_core 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "redox_syscall" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a" +dependencies = [ + "bitflags", +] + [[package]] name = "regex" version = "1.7.0" @@ -643,6 +1042,45 @@ version = "0.6.28" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "456c603be3e8d448b072f410900c09faf164fbce2d480456f50eea6e25f9c848" +[[package]] +name = "reqwest" +version = "0.11.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "27b71749df584b7f4cac2c426c127a7c785a5106cc98f7a8feb044115f0fa254" +dependencies = [ + "base64 0.21.0", + "bytes", + "encoding_rs", + "futures-core", + "futures-util", + "h2", + "http", + "http-body", + "hyper", + "hyper-tls", + "ipnet", + "js-sys", + "log", + "mime", + "native-tls", + "once_cell", + "percent-encoding", + "pin-project-lite", + "serde", + "serde_json", + "serde_urlencoded", + "tokio", + "tokio-native-tls", + "tokio-util", + "tower-service", + "url", + "wasm-bindgen", + "wasm-bindgen-futures", + "wasm-streams", + "web-sys", + "winreg", +] + [[package]] name = "ring" version = "0.16.20" @@ -678,6 +1116,20 @@ dependencies = [ "serde_json", ] +[[package]] +name = "rustix" +version = "0.36.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd5c6ff11fecd55b40746d1995a02f2eb375bf8c00d192d521ee09f42bef37bc" +dependencies = [ + "bitflags", + "errno", + "io-lifetimes", + "libc", + "linux-raw-sys", + "windows-sys 0.45.0", +] + [[package]] name = "rustls" version = "0.17.0" @@ -722,6 +1174,15 @@ version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7b4b9743ed687d4b4bcedf9ff5eaa7398495ae14e61cba0a295704edbc7decde" +[[package]] +name = "schannel" +version = "0.1.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "713cfb06c7059f3588fb8044c0fad1d09e3c01d225e25b9220dbfdcf16dbb1b3" +dependencies = [ + "windows-sys 0.42.0", +] + [[package]] name = "sct" version = "0.6.1" @@ -732,6 +1193,29 @@ dependencies = [ "untrusted", ] +[[package]] +name = "security-framework" +version = "2.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a332be01508d814fed64bf28f798a146d73792121129962fdf335bb3c49a4254" +dependencies = [ + "bitflags", + "core-foundation", + "core-foundation-sys", + "libc", + "security-framework-sys", +] + +[[package]] +name = "security-framework-sys" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "31c9bb296072e961fcbd8853511dd39c2d8be2deb1e17c6860b1d30732b323b4" +dependencies = [ + "core-foundation-sys", + "libc", +] + [[package]] name = "serde" version = "1.0.151" @@ -747,8 +1231,8 @@ version = "1.0.151" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "255abe9a125a985c05190d687b320c12f9b1f0b99445e608c21ba0782c719ad8" dependencies = [ - "proc-macro2 1.0.49", - "quote 1.0.23", + "proc-macro2 1.0.56", + "quote 1.0.26", "syn 1.0.107", ] @@ -763,6 +1247,18 @@ dependencies = [ "serde", ] +[[package]] +name = "serde_urlencoded" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" +dependencies = [ + "form_urlencoded", + "itoa", + "ryu", + "serde", +] + [[package]] name = "sgx_alloc" version = "2.0.0" @@ -829,8 +1325,8 @@ dependencies = [ name = "sgx_macros" version = "2.0.0" dependencies = [ - "proc-macro2 1.0.49", - "quote 1.0.23", + "proc-macro2 1.0.56", + "quote 1.0.26", "syn 1.0.107", ] @@ -980,6 +1476,15 @@ dependencies = [ "num-traits", ] +[[package]] +name = "slab" +version = "0.4.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6528351c9bc8ab22353f9d776db39a20288e8d6c37ef8cfe3317cf875eecfc2d" +dependencies = [ + "autocfg", +] + [[package]] name = "snap" version = "0.2.5" @@ -990,6 +1495,16 @@ dependencies = [ "lazy_static", ] +[[package]] +name = "socket2" +version = "0.4.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "64a4a911eed85daf18834cfaa86a79b7d266ff93ff5ba14005426219480ed662" +dependencies = [ + "libc", + "winapi", +] + [[package]] name = "spin" version = "0.5.2" @@ -1019,8 +1534,8 @@ version = "1.0.107" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1f4064b5b16e03ae50984a5a8ed5d4f8803e6bc1fd170a3cda91a1be4b18e3f5" dependencies = [ - "proc-macro2 1.0.49", - "quote 1.0.23", + "proc-macro2 1.0.56", + "quote 1.0.26", "unicode-ident", ] @@ -1058,6 +1573,7 @@ dependencies = [ "chrono", "hex", "httparse", + "libc", "log", "num-bigint 0.2.6", "percent-encoding", @@ -1171,6 +1687,7 @@ dependencies = [ "teaclave_binder", "teaclave_config", "teaclave_crypto", + "teaclave_file_agent", "teaclave_proto", "teaclave_rpc", "teaclave_service_enclave_utils", @@ -1224,6 +1741,28 @@ dependencies = [ "thiserror", ] +[[package]] +name = "teaclave_file_agent" +version = "0.5.0" +dependencies = [ + "anyhow", + "base64 0.13.1", + "futures", + "futures-util", + "http", + "itertools 0.8.2", + "log", + "reqwest", + "serde", + "serde_json", + "teaclave_test_utils", + "teaclave_types", + "thiserror", + "tokio", + "tokio-util", + "url", +] + [[package]] name = "teaclave_frontend_service_enclave" version = "0.5.0" @@ -1386,6 +1925,7 @@ dependencies = [ "anyhow", "cfg-if 0.1.10", "http", + "libc", "log", "rustls", "serde", @@ -1403,8 +1943,8 @@ dependencies = [ name = "teaclave_rpc_proc_macro" version = "0.5.0" dependencies = [ - "proc-macro2 1.0.49", - "quote 1.0.23", + "proc-macro2 1.0.56", + "quote 1.0.26", "syn 1.0.107", ] @@ -1465,8 +2005,8 @@ dependencies = [ name = "teaclave_service_enclave_utils_proc_macro" version = "0.5.0" dependencies = [ - "proc-macro2 1.0.49", - "quote 1.0.23", + "proc-macro2 1.0.56", + "quote 1.0.26", "syn 1.0.107", ] @@ -1520,8 +2060,8 @@ dependencies = [ name = "teaclave_test_utils_proc_macro" version = "0.0.1" dependencies = [ - "proc-macro2 1.0.49", - "quote 1.0.23", + "proc-macro2 1.0.56", + "quote 1.0.26", "syn 1.0.107", ] @@ -1595,6 +2135,19 @@ dependencies = [ "thiserror", ] +[[package]] +name = "tempfile" +version = "3.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af18f7ae1acd354b992402e9ec5864359d693cd8a79dcbef59f76891701c1e95" +dependencies = [ + "cfg-if 1.0.0", + "fastrand", + "redox_syscall", + "rustix", + "windows-sys 0.42.0", +] + [[package]] name = "thiserror" version = "1.0.38" @@ -1610,8 +2163,8 @@ version = "1.0.38" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1fb327af4685e4d03fa8cbcf1716380da910eeb2bb8be417e7f9fd3fb164f36f" dependencies = [ - "proc-macro2 1.0.49", - "quote 1.0.23", + "proc-macro2 1.0.56", + "quote 1.0.26", "syn 1.0.107", ] @@ -1639,6 +2192,46 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c" +[[package]] +name = "tokio" +version = "1.27.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0de47a4eecbe11f498978a9b29d792f0d2692d1dd003650c24c76510e3bc001" +dependencies = [ + "autocfg", + "bytes", + "libc", + "mio", + "num_cpus", + "pin-project-lite", + "socket2", + "windows-sys 0.45.0", +] + +[[package]] +name = "tokio-native-tls" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbae76ab933c85776efabc971569dd6119c580d8f5d448769dec1764bf796ef2" +dependencies = [ + "native-tls", + "tokio", +] + +[[package]] +name = "tokio-util" +version = "0.7.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5427d89453009325de0d8f342c9490009f76e999cb7672d77e46267448f7e6b2" +dependencies = [ + "bytes", + "futures-core", + "futures-sink", + "pin-project-lite", + "tokio", + "tracing", +] + [[package]] name = "toml" version = "0.5.10" @@ -1648,6 +2241,38 @@ dependencies = [ "serde", ] +[[package]] +name = "tower-service" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52" + +[[package]] +name = "tracing" +version = "0.1.37" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ce8c33a8d48bd45d624a6e523445fd21ec13d3653cd51f681abf67418f54eb8" +dependencies = [ + "cfg-if 1.0.0", + "pin-project-lite", + "tracing-core", +] + +[[package]] +name = "tracing-core" +version = "0.1.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24eb03ba0eab1fd845050058ce5e616558e8f8d8fca633e6b163fe25c797213a" +dependencies = [ + "once_cell", +] + +[[package]] +name = "try-lock" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3528ecfd12c466c6f163363caf2d02a71161dd5e1cc6ae7b34207ea2d42d81ed" + [[package]] name = "unicode-bidi" version = "0.3.8" @@ -1715,18 +2340,40 @@ dependencies = [ "version_check", ] +[[package]] +name = "vcpkg" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" + [[package]] name = "version_check" version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" +[[package]] +name = "want" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ce8a968cb1cd110d136ff8b819a556d6fb6d919363c61534f6860c7eb172ba0" +dependencies = [ + "log", + "try-lock", +] + [[package]] name = "wasi" version = "0.10.2+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fd6fbd9a79829dd1ad0cc20627bf1ed606756a7f77edff7b66b7064f9cb327c6" +[[package]] +name = "wasi" +version = "0.11.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" + [[package]] name = "wasm-bindgen" version = "0.2.83" @@ -1746,19 +2393,31 @@ dependencies = [ "bumpalo", "log", "once_cell", - "proc-macro2 1.0.49", - "quote 1.0.23", + "proc-macro2 1.0.56", + "quote 1.0.26", "syn 1.0.107", "wasm-bindgen-shared", ] +[[package]] +name = "wasm-bindgen-futures" +version = "0.4.33" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23639446165ca5a5de86ae1d8896b737ae80319560fbaa4c2887b7da6e7ebd7d" +dependencies = [ + "cfg-if 1.0.0", + "js-sys", + "wasm-bindgen", + "web-sys", +] + [[package]] name = "wasm-bindgen-macro" version = "0.2.83" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "052be0f94026e6cbc75cdefc9bae13fd6052cdcaf532fa6c45e7ae33a1e6c810" dependencies = [ - "quote 1.0.23", + "quote 1.0.26", "wasm-bindgen-macro-support", ] @@ -1768,8 +2427,8 @@ version = "0.2.83" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "07bc0c051dc5f23e307b13285f9d75df86bfdf816c5721e573dec1f9b8aa193c" dependencies = [ - "proc-macro2 1.0.49", - "quote 1.0.23", + "proc-macro2 1.0.56", + "quote 1.0.26", "syn 1.0.107", "wasm-bindgen-backend", "wasm-bindgen-shared", @@ -1781,6 +2440,19 @@ version = "0.2.83" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1c38c045535d93ec4f0b4defec448e4291638ee608530863b1e2ba115d4fff7f" +[[package]] +name = "wasm-streams" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6bbae3363c08332cadccd13b67db371814cd214c2524020932f0804b8cf7c078" +dependencies = [ + "futures-util", + "js-sys", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", +] + [[package]] name = "web-sys" version = "0.3.60" @@ -1832,6 +2504,96 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" +[[package]] +name = "windows-sys" +version = "0.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7" +dependencies = [ + "windows_aarch64_gnullvm", + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc", +] + +[[package]] +name = "windows-sys" +version = "0.45.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0" +dependencies = [ + "windows-targets", +] + +[[package]] +name = "windows-targets" +version = "0.42.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e2522491fbfcd58cc84d47aeb2958948c4b8982e9a2d8a2a35bbaed431390e7" +dependencies = [ + "windows_aarch64_gnullvm", + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.42.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c9864e83243fdec7fc9c5444389dcbbfd258f745e7853198f365e3c4968a608" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.42.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c8b1b673ffc16c47a9ff48570a9d85e25d265735c503681332589af6253c6c7" + +[[package]] +name = "windows_i686_gnu" +version = "0.42.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "de3887528ad530ba7bdbb1faa8275ec7a1155a45ffa57c37993960277145d640" + +[[package]] +name = "windows_i686_msvc" +version = "0.42.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf4d1122317eddd6ff351aa852118a2418ad4214e6613a50e0191f7004372605" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.42.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c1040f221285e17ebccbc2591ffdc2d44ee1f9186324dd3e84e99ac68d699c45" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.42.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "628bfdf232daa22b0d64fdb62b09fcc36bb01f05a3939e20ab73aaf9470d0463" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.42.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "447660ad36a13288b1db4d4248e857b510e8c3a225c822ba4fb748c0aafecffd" + +[[package]] +name = "winreg" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "80d0f4e272c85def139476380b12f9ac60926689dd2e01d4923222f40580869d" +dependencies = [ + "winapi", +] + [[package]] name = "yasna" version = "0.3.2" diff --git a/cmake/tomls/Cargo.sgx_untrusted_app.lock b/cmake/tomls/Cargo.sgx_untrusted_app.lock index 758e3e6d..e4aebc45 100644 --- a/cmake/tomls/Cargo.sgx_untrusted_app.lock +++ b/cmake/tomls/Cargo.sgx_untrusted_app.lock @@ -37,12 +37,27 @@ dependencies = [ "winapi", ] +[[package]] +name = "autocfg" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0dde43e75fd43e8a1bf86103336bc699aa8d17ad1be60c76c0bdfd4828e19b78" +dependencies = [ + "autocfg 1.1.0", +] + [[package]] name = "autocfg" version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" +[[package]] +name = "base64" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b41b7ea54a0c9d92199de89e20e58d49f02f8e699814ef3fdf266f6f748d15c7" + [[package]] name = "base64" version = "0.13.1" @@ -55,6 +70,12 @@ version = "0.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a4a4ddaa51a5bc52a6948f74c06d20aaaddb71924eab79b8c97a8c556e942d6a" +[[package]] +name = "bit-vec" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "349f9b6a179ed607305526ca489b34ad0a41aed5f7980fa90eb03160b69598fb" + [[package]] name = "bitflags" version = "1.3.2" @@ -67,6 +88,18 @@ version = "3.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "572f695136211188308f16ad2ca5c851a712c464060ae6974944458eb83880ba" +[[package]] +name = "bytemuck" +version = "1.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "17febce684fd15d89027105661fec94afb475cb995fbc59d2865198446ba2eea" + +[[package]] +name = "byteorder" +version = "1.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" + [[package]] name = "bytes" version = "1.3.0" @@ -91,6 +124,16 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" +[[package]] +name = "chrono" +version = "0.4.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "16b0a3d9ed01224b22057780a37bb8c5dbfe1be8ba48678e7bf57ec4b385411f" +dependencies = [ + "num-integer", + "num-traits", +] + [[package]] name = "clap" version = "2.34.0" @@ -106,6 +149,21 @@ dependencies = [ "vec_map", ] +[[package]] +name = "cloudabi" +version = "0.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" +dependencies = [ + "bitflags", +] + +[[package]] +name = "color_quant" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d7b894f5411737b7867f4827955924d7c254fc9f4d91a6aad6b097804b1018b" + [[package]] name = "core-foundation" version = "0.9.3" @@ -128,7 +186,7 @@ version = "0.1.26" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6d2301688392eb071b0bf1a37be05c469d3cc4dbbd95df672fe28ab021e6a096" dependencies = [ - "quote 1.0.23", + "quote 1.0.26", "syn 1.0.107", ] @@ -170,6 +228,15 @@ dependencies = [ "termcolor", ] +[[package]] +name = "env_logger" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a12e6657c4c97ebab115a42dcee77225f7f482cdd841cf7088c657a42e9e00e7" +dependencies = [ + "log", +] + [[package]] name = "fastrand" version = "1.8.0" @@ -209,6 +276,12 @@ dependencies = [ "percent-encoding", ] +[[package]] +name = "fuchsia-cprng" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba" + [[package]] name = "futures" version = "0.3.25" @@ -263,8 +336,8 @@ version = "0.3.25" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bdfb8ce053d86b91919aad980c220b1fb8401a9394410e1c289ed7e66b61835d" dependencies = [ - "proc-macro2 1.0.49", - "quote 1.0.23", + "proc-macro2 1.0.56", + "quote 1.0.26", "syn 1.0.107", ] @@ -298,6 +371,20 @@ dependencies = [ "slab", ] +[[package]] +name = "gbdt" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "74248386ea349f903cee13fae53f41bdae987f74eb798c6cbcb08370c99ccd34" +dependencies = [ + "cfg-if 0.1.10", + "rand 0.6.5", + "regex", + "serde", + "serde_derive", + "serde_json", +] + [[package]] name = "getrandom" version = "0.2.8" @@ -315,8 +402,8 @@ version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "41973d4c45f7a35af8753ba3457cc99d406d863941fd7f52663cff54a5ab99b3" dependencies = [ - "proc-macro2 1.0.49", - "quote 1.0.23", + "proc-macro2 1.0.56", + "quote 1.0.26", "syn 1.0.107", ] @@ -472,13 +559,28 @@ dependencies = [ "unicode-normalization", ] +[[package]] +name = "image" +version = "0.23.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24ffcb7e7244a9bf19d35bf2883b9c080c4ced3c07a9895572178cdb8f13f6a1" +dependencies = [ + "bytemuck", + "byteorder", + "color_quant", + "jpeg-decoder", + "num-iter", + "num-rational", + "num-traits", +] + [[package]] name = "indexmap" version = "1.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1885e79c1fc4b10f0e172c475f458b7f7b93061064d98c3293e98c5ba0c8b399" dependencies = [ - "autocfg", + "autocfg 1.1.0", "hashbrown", ] @@ -508,8 +610,8 @@ version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7e41b53715c6f0c4be49510bb82dee2c1e51c8586d885abe65396e82ed518548" dependencies = [ - "proc-macro2 1.0.49", - "quote 1.0.23", + "proc-macro2 1.0.56", + "quote 1.0.26", "syn 1.0.107", ] @@ -528,12 +630,27 @@ dependencies = [ "either", ] +[[package]] +name = "itertools" +version = "0.10.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473" +dependencies = [ + "either", +] + [[package]] name = "itoa" version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fad582f4b9e86b6caa621cabeb0963332d92eea04729ab12892c2533951e6440" +[[package]] +name = "jpeg-decoder" +version = "0.1.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "229d53d58899083193af11e15917b5640cd40b29ff475a1fe4ef725deb02d0f2" + [[package]] name = "js-sys" version = "0.3.60" @@ -555,6 +672,12 @@ version = "0.2.139" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "201de327520df007757c1f0adce6e827fe8562fbc28bfd9c15571c66ca1f5f79" +[[package]] +name = "libm" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "348108ab3fba42ec82ff6e9564fc4ca0247bdccdc68dd8af9764bbc79c3c8ffb" + [[package]] name = "log" version = "0.4.17" @@ -562,6 +685,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e" dependencies = [ "cfg-if 1.0.0", + "value-bag", +] + +[[package]] +name = "matrixmultiply" +version = "0.1.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dcad67dcec2d58ff56f6292582377e6921afdf3bfbd533e26fb8900ae575e002" +dependencies = [ + "rawpointer", ] [[package]] @@ -618,6 +751,105 @@ dependencies = [ "static_assertions", ] +[[package]] +name = "num" +version = "0.1.42" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4703ad64153382334aa8db57c637364c322d3372e097840c72000dabdcf6156e" +dependencies = [ + "num-integer", + "num-iter", + "num-traits", +] + +[[package]] +name = "num" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b7a8e9be5e039e2ff869df49155f1c06bd01ade2117ec783e56ab0932b67a8f" +dependencies = [ + "num-bigint 0.3.3", + "num-complex", + "num-integer", + "num-iter", + "num-rational", + "num-traits", +] + +[[package]] +name = "num-bigint" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "090c7f9998ee0ff65aa5b723e4009f7b217707f1fb5ea551329cc4d6231fb304" +dependencies = [ + "autocfg 1.1.0", + "num-integer", + "num-traits", +] + +[[package]] +name = "num-bigint" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f6f7833f2cbf2360a6cfd58cd41a53aa7a90bd4c202f5b1c7dd2ed73c57b2c3" +dependencies = [ + "autocfg 1.1.0", + "num-integer", + "num-traits", +] + +[[package]] +name = "num-complex" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "747d632c0c558b87dbabbe6a82f3b4ae03720d0646ac5b7b4dae89394be5f2c5" +dependencies = [ + "num-traits", +] + +[[package]] +name = "num-integer" +version = "0.1.45" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9" +dependencies = [ + "autocfg 1.1.0", + "num-traits", +] + +[[package]] +name = "num-iter" +version = "0.1.43" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d03e6c028c5dc5cac6e2dec0efda81fc887605bb3d884578bb6d6bf7514e252" +dependencies = [ + "autocfg 1.1.0", + "num-integer", + "num-traits", +] + +[[package]] +name = "num-rational" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "12ac428b1cb17fce6f731001d307d351ec70a6d202fc2e60f7d4c5e42d8f4f07" +dependencies = [ + "autocfg 1.1.0", + "num-bigint 0.3.3", + "num-integer", + "num-traits", +] + +[[package]] +name = "num-traits" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd" +dependencies = [ + "autocfg 1.1.0", + "libm", +] + [[package]] name = "num_cpus" version = "1.15.0" @@ -655,8 +887,8 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b501e44f11665960c7e7fcf062c7d96a14ade4aa98116c004b2e37b5be7d736c" dependencies = [ - "proc-macro2 1.0.49", - "quote 1.0.23", + "proc-macro2 1.0.56", + "quote 1.0.26", "syn 1.0.107", ] @@ -672,7 +904,7 @@ version = "0.9.80" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "23bbbf7854cd45b83958ebe919f0e8e516793727652e27fda10a8384cfc790b7" dependencies = [ - "autocfg", + "autocfg 1.1.0", "cc", "libc", "pkg-config", @@ -716,8 +948,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" dependencies = [ "proc-macro-error-attr", - "proc-macro2 1.0.49", - "quote 1.0.23", + "proc-macro2 1.0.56", + "quote 1.0.26", "syn 1.0.107", "version_check", ] @@ -728,8 +960,8 @@ version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" dependencies = [ - "proc-macro2 1.0.49", - "quote 1.0.23", + "proc-macro2 1.0.56", + "quote 1.0.26", "version_check", ] @@ -744,13 +976,36 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.49" +version = "1.0.56" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57a8eca9f9c4ffde41714334dee777596264c7825420f521abc92b5b5deb63a5" +checksum = "2b63bdb0cd06f1f4dedf69b254734f9b45af66e4a031e42a7480257d9898b435" dependencies = [ "unicode-ident", ] +[[package]] +name = "prost" +version = "0.11.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e48e50df39172a3e7eb17e14642445da64996989bc212b583015435d39a58537" +dependencies = [ + "bytes", + "prost-derive", +] + +[[package]] +name = "prost-derive" +version = "0.11.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ea9b0f8cbe5e15a8a042d030bd96668db28ecb567ec37d691971ff5731d2b1b" +dependencies = [ + "anyhow", + "itertools 0.10.5", + "proc-macro2 1.0.56", + "quote 1.0.26", + "syn 1.0.107", +] + [[package]] name = "quick-error" version = "1.2.3" @@ -768,11 +1023,30 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.23" +version = "1.0.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8856d8364d252a14d474036ea1358d63c9e6965c8e5c1885c18f73d70bff9c7b" +checksum = "4424af4bf778aae2051a77b60283332f386554255d722233d09fbfc7e30da2fc" dependencies = [ - "proc-macro2 1.0.49", + "proc-macro2 1.0.56", +] + +[[package]] +name = "rand" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d71dacdc3c88c1fde3885a3be3fbab9f35724e6ce99467f7d9c5026132184ca" +dependencies = [ + "autocfg 0.1.8", + "libc", + "rand_chacha 0.1.1", + "rand_core 0.4.2", + "rand_hc", + "rand_isaac", + "rand_jitter", + "rand_os", + "rand_pcg", + "rand_xorshift", + "winapi", ] [[package]] @@ -782,8 +1056,18 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" dependencies = [ "libc", - "rand_chacha", - "rand_core", + "rand_chacha 0.3.1", + "rand_core 0.6.4", +] + +[[package]] +name = "rand_chacha" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "556d3a1ca6600bfcbab7c7c91ccb085ac7fbbcd70e008a98742e7847f4f7bcef" +dependencies = [ + "autocfg 0.1.8", + "rand_core 0.3.1", ] [[package]] @@ -793,9 +1077,24 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" dependencies = [ "ppv-lite86", - "rand_core", + "rand_core 0.6.4", +] + +[[package]] +name = "rand_core" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a6fdeb83b075e8266dcc8762c22776f6877a63111121f5f8c7411e5be7eed4b" +dependencies = [ + "rand_core 0.4.2", ] +[[package]] +name = "rand_core" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c33a3c44ca05fa6f1807d8e6743f3824e8509beca625669633be0acbdf509dc" + [[package]] name = "rand_core" version = "0.6.4" @@ -805,6 +1104,78 @@ dependencies = [ "getrandom", ] +[[package]] +name = "rand_distr" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32cb0b9bc82b0a0876c2dd994a7e7a2683d3e7390ca40e6886785ef0c7e3ee31" +dependencies = [ + "num-traits", + "rand 0.8.5", +] + +[[package]] +name = "rand_hc" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b40677c7be09ae76218dc623efbf7b18e34bced3f38883af07bb75630a21bc4" +dependencies = [ + "rand_core 0.3.1", +] + +[[package]] +name = "rand_isaac" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ded997c9d5f13925be2a6fd7e66bf1872597f759fd9dd93513dd7e92e5a5ee08" +dependencies = [ + "rand_core 0.3.1", +] + +[[package]] +name = "rand_jitter" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1166d5c91dc97b88d1decc3285bb0a99ed84b05cfd0bc2341bdf2d43fc41e39b" +dependencies = [ + "libc", + "rand_core 0.4.2", + "winapi", +] + +[[package]] +name = "rand_os" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b75f676a1e053fc562eafbb47838d67c84801e38fc1ba459e8f180deabd5071" +dependencies = [ + "cloudabi", + "fuchsia-cprng", + "libc", + "rand_core 0.4.2", + "rdrand 0.4.0", + "winapi", +] + +[[package]] +name = "rand_pcg" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "abf9b09b01790cfe0364f52bf32995ea3c39f4d2dd011eac241d2914146d0b44" +dependencies = [ + "autocfg 0.1.8", + "rand_core 0.4.2", +] + +[[package]] +name = "rand_xorshift" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cbf7e9e623549b0e21f6e97cf8ecf247c1a8fd2e8a992ae265314300b2455d5c" +dependencies = [ + "rand_core 0.3.1", +] + [[package]] name = "raw-cpuid" version = "10.7.0" @@ -814,13 +1185,28 @@ dependencies = [ "bitflags", ] +[[package]] +name = "rawpointer" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebac11a9d2e11f2af219b8b8d833b76b1ea0e054aa0e8d8e9e4cbde353bdf019" + +[[package]] +name = "rdrand" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "678054eb77286b51581ba43620cc911abf02758c91f93f479767aed0f90458b2" +dependencies = [ + "rand_core 0.3.1", +] + [[package]] name = "rdrand" version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e233b642160555c1aa1ff7a78443c6139342f411b6fa6602af2ebbfee9e166bb" dependencies = [ - "rand_core", + "rand_core 0.6.4", ] [[package]] @@ -912,6 +1298,53 @@ dependencies = [ "winapi", ] +[[package]] +name = "rulinalg" +version = "0.4.2" +source = "git+https://github.com/AtheMathmo/rulinalg?rev=1ed8b937#1ed8b937d7b54d08a440f7db91994142bfe47388" +dependencies = [ + "matrixmultiply", + "num 0.1.42", +] + +[[package]] +name = "rustface" +version = "0.1.7" +source = "git+https://github.com/apache/incubator-teaclave-crates#4c9325839e94bb8e280898f94c98a79cdc025312" +dependencies = [ + "byteorder", + "image", + "num 0.3.1", + "serde", + "serde_json", +] + +[[package]] +name = "rustls" +version = "0.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0d4a31f5d68413404705d6982529b0e11a9aacd4839d1d6222ee3b8cb4015e1" +dependencies = [ + "base64 0.11.0", + "log", + "ring", + "sct", + "webpki", +] + +[[package]] +name = "rusty-machine" +version = "0.5.4" +source = "git+https://github.com/apache/incubator-teaclave-crates#4c9325839e94bb8e280898f94c98a79cdc025312" +dependencies = [ + "num 0.1.42", + "rand 0.8.5", + "rand_distr", + "rulinalg", + "serde", + "serde_json", +] + [[package]] name = "ryu" version = "1.0.12" @@ -928,6 +1361,16 @@ dependencies = [ "windows-sys 0.36.1", ] +[[package]] +name = "sct" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b362b83898e0e69f38515b82ee15aa80636befe47c3b6d3d89a911e78fc228ce" +dependencies = [ + "ring", + "untrusted", +] + [[package]] name = "security-framework" version = "2.7.0" @@ -966,8 +1409,8 @@ version = "1.0.151" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "255abe9a125a985c05190d687b320c12f9b1f0b99445e608c21ba0782c719ad8" dependencies = [ - "proc-macro2 1.0.49", - "quote 1.0.23", + "proc-macro2 1.0.56", + "quote 1.0.26", "syn 1.0.107", ] @@ -1002,6 +1445,15 @@ version = "2.0.0" name = "sgx_build_helper" version = "2.0.0" +[[package]] +name = "sgx_cov" +version = "2.0.0" +dependencies = [ + "sgx_trts", + "sgx_tstd", + "sgx_types", +] + [[package]] name = "sgx_crypto" version = "2.0.0" @@ -1035,6 +1487,27 @@ dependencies = [ "sgx_types", ] +[[package]] +name = "sgx_libc" +version = "2.0.0" +dependencies = [ + "sgx_ffi", + "sgx_oc", + "sgx_sync", + "sgx_tlibc_sys", + "sgx_trts", + "sgx_types", +] + +[[package]] +name = "sgx_macros" +version = "2.0.0" +dependencies = [ + "proc-macro2 1.0.56", + "quote 1.0.26", + "syn 1.0.107", +] + [[package]] name = "sgx_oc" version = "2.0.0" @@ -1049,8 +1522,8 @@ dependencies = [ name = "sgx_rand" version = "2.0.0" dependencies = [ - "rand_core", - "rdrand", + "rand_core 0.6.4", + "rdrand 0.8.2", "sgx_trts", "sgx_tstd", ] @@ -1196,7 +1669,7 @@ version = "0.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4614a76b2a8be0058caa9dbbaf66d988527d86d003c11a94fbd335d7661edcef" dependencies = [ - "autocfg", + "autocfg 1.1.0", ] [[package]] @@ -1246,11 +1719,17 @@ checksum = "dcb5ae327f9cc13b68763b5749770cb9e048a99bd9dfdfa58d0cf05d5f64afe0" dependencies = [ "heck", "proc-macro-error", - "proc-macro2 1.0.49", - "quote 1.0.23", + "proc-macro2 1.0.56", + "quote 1.0.26", "syn 1.0.107", ] +[[package]] +name = "sval" +version = "1.0.0-alpha.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "45f6ee7c7b87caf59549e9fe45d6a69c75c8019e79e212a835c5da0e92f0ba08" + [[package]] name = "syn" version = "0.15.44" @@ -1268,8 +1747,8 @@ version = "1.0.107" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1f4064b5b16e03ae50984a5a8ed5d4f8803e6bc1fd170a3cda91a1be4b18e3f5" dependencies = [ - "proc-macro2 1.0.49", - "quote 1.0.23", + "proc-macro2 1.0.56", + "quote 1.0.26", "unicode-ident", ] @@ -1278,18 +1757,51 @@ name = "teaclave_access_control_service" version = "0.5.0" dependencies = [ "anyhow", - "env_logger", + "env_logger 0.7.1", "libc", "signal-hook", "teaclave_service_app_utils", ] +[[package]] +name = "teaclave_attestation" +version = "0.5.0" +dependencies = [ + "anyhow", + "base64 0.13.1", + "bit-vec", + "cfg-if 0.1.10", + "chrono", + "hex", + "httparse", + "libc", + "log", + "num-bigint 0.2.6", + "percent-encoding", + "rustls", + "serde", + "serde_json", + "sgx_crypto", + "sgx_rand", + "sgx_tse", + "sgx_types", + "teaclave_config", + "teaclave_test_utils", + "teaclave_types", + "thiserror", + "url", + "uuid", + "webpki", + "webpki-roots", + "yasna", +] + [[package]] name = "teaclave_authentication_service" version = "0.5.0" dependencies = [ "anyhow", - "env_logger", + "env_logger 0.7.1", "libc", "signal-hook", "teaclave_service_app_utils", @@ -1338,7 +1850,7 @@ version = "0.5.0" dependencies = [ "anyhow", "hex", - "rand", + "rand 0.8.5", "ring", "serde", "serde_json", @@ -1351,13 +1863,86 @@ name = "teaclave_execution_service" version = "0.5.0" dependencies = [ "anyhow", - "env_logger", + "env_logger 0.7.1", "libc", + "log", "signal-hook", + "teaclave_config", + "teaclave_execution_service_enclave", "teaclave_file_agent", + "teaclave_logger", "teaclave_service_app_utils", ] +[[package]] +name = "teaclave_execution_service_enclave" +version = "0.5.0" +dependencies = [ + "anyhow", + "gbdt", + "log", + "serde", + "serde_json", + "sgx_cov", + "sgx_types", + "teaclave_attestation", + "teaclave_binder", + "teaclave_config", + "teaclave_crypto", + "teaclave_file_agent", + "teaclave_proto", + "teaclave_rpc", + "teaclave_service_enclave_utils", + "teaclave_test_utils", + "teaclave_types", + "teaclave_worker", + "thiserror", + "url", + "uuid", +] + +[[package]] +name = "teaclave_executor" +version = "0.5.0" +dependencies = [ + "anyhow", + "gbdt", + "itertools 0.8.2", + "log", + "rusty-machine", + "serde", + "serde_json", + "sgx_cov", + "sgx_types", + "teaclave_crypto", + "teaclave_executor_context", + "teaclave_function", + "teaclave_runtime", + "teaclave_test_utils", + "teaclave_types", + "thiserror", +] + +[[package]] +name = "teaclave_executor_context" +version = "0.5.0" +dependencies = [ + "anyhow", + "gbdt", + "itertools 0.8.2", + "log", + "rusty-machine", + "serde", + "serde_json", + "sgx_cov", + "sgx_types", + "teaclave_crypto", + "teaclave_runtime", + "teaclave_test_utils", + "teaclave_types", + "thiserror", +] + [[package]] name = "teaclave_file_agent" version = "0.5.0" @@ -1367,7 +1952,7 @@ dependencies = [ "futures", "futures-util", "http", - "itertools", + "itertools 0.8.2", "log", "reqwest", "serde", @@ -1385,18 +1970,44 @@ name = "teaclave_frontend_service" version = "0.5.0" dependencies = [ "anyhow", - "env_logger", + "env_logger 0.7.1", "libc", "signal-hook", "teaclave_service_app_utils", ] +[[package]] +name = "teaclave_function" +version = "0.5.0" +dependencies = [ + "anyhow", + "base64 0.13.1", + "gbdt", + "hex", + "image", + "itertools 0.8.2", + "log", + "ring", + "rustface", + "rusty-machine", + "serde", + "serde_json", + "sgx_cov", + "sgx_types", + "teaclave_crypto", + "teaclave_executor_context", + "teaclave_runtime", + "teaclave_test_utils", + "teaclave_types", + "thiserror", +] + [[package]] name = "teaclave_functional_tests" version = "0.5.0" dependencies = [ "anyhow", - "env_logger", + "env_logger 0.7.1", "log", "sgx_types", "structopt", @@ -1409,7 +2020,7 @@ name = "teaclave_integration_tests" version = "0.5.0" dependencies = [ "anyhow", - "env_logger", + "env_logger 0.7.1", "log", "sgx_types", "teaclave_binder", @@ -1418,23 +2029,96 @@ dependencies = [ "teaclave_types", ] +[[package]] +name = "teaclave_logger" +version = "0.5.0" +dependencies = [ + "anyhow", + "log", + "sgx_cov", + "sgx_types", + "teaclave_test_utils", +] + [[package]] name = "teaclave_management_service" version = "0.5.0" dependencies = [ "anyhow", - "env_logger", + "env_logger 0.7.1", "libc", "signal-hook", "teaclave_service_app_utils", ] +[[package]] +name = "teaclave_proto" +version = "0.5.0" +dependencies = [ + "anyhow", + "base64 0.13.1", + "cfg-if 0.1.10", + "prost", + "rand 0.8.5", + "serde", + "serde_json", + "sgx_cov", + "sgx_types", + "teaclave_crypto", + "teaclave_rpc", + "teaclave_types", + "url", + "uuid", +] + +[[package]] +name = "teaclave_rpc" +version = "0.5.0" +dependencies = [ + "anyhow", + "cfg-if 0.1.10", + "http", + "libc", + "log", + "rustls", + "serde", + "serde_json", + "sgx_libc", + "teaclave_attestation", + "teaclave_rpc_proc_macro", + "teaclave_types", + "thiserror", + "threadpool", + "webpki", +] + +[[package]] +name = "teaclave_rpc_proc_macro" +version = "0.5.0" +dependencies = [ + "proc-macro2 1.0.56", + "quote 1.0.26", + "syn 1.0.107", +] + +[[package]] +name = "teaclave_runtime" +version = "0.5.0" +dependencies = [ + "anyhow", + "log", + "sgx_cov", + "sgx_types", + "teaclave_test_utils", + "teaclave_types", +] + [[package]] name = "teaclave_scheduler_service" version = "0.5.0" dependencies = [ "anyhow", - "env_logger", + "env_logger 0.7.1", "libc", "signal-hook", "teaclave_service_app_utils", @@ -1446,7 +2130,7 @@ version = "0.5.0" dependencies = [ "anyhow", "ctrlc", - "env_logger", + "env_logger 0.7.1", "libc", "log", "signal-hook", @@ -1455,12 +2139,39 @@ dependencies = [ "teaclave_types", ] +[[package]] +name = "teaclave_service_enclave_utils" +version = "0.5.0" +dependencies = [ + "anyhow", + "env_logger 0.9.3", + "log", + "sgx_cov", + "sgx_macros", + "teaclave_attestation", + "teaclave_config", + "teaclave_logger", + "teaclave_proto", + "teaclave_rpc", + "teaclave_service_enclave_utils_proc_macro", + "teaclave_types", +] + +[[package]] +name = "teaclave_service_enclave_utils_proc_macro" +version = "0.5.0" +dependencies = [ + "proc-macro2 1.0.56", + "quote 1.0.26", + "syn 1.0.107", +] + [[package]] name = "teaclave_sgx_tool" version = "0.5.0" dependencies = [ "anyhow", - "env_logger", + "env_logger 0.7.1", "log", "raw-cpuid", "serde", @@ -1476,7 +2187,7 @@ name = "teaclave_storage_service" version = "0.5.0" dependencies = [ "anyhow", - "env_logger", + "env_logger 0.7.1", "libc", "signal-hook", "teaclave_service_app_utils", @@ -1494,8 +2205,8 @@ dependencies = [ name = "teaclave_test_utils_proc_macro" version = "0.0.1" dependencies = [ - "proc-macro2 1.0.49", - "quote 1.0.23", + "proc-macro2 1.0.56", + "quote 1.0.26", "syn 1.0.107", ] @@ -1506,7 +2217,7 @@ dependencies = [ "anyhow", "hex", "log", - "rand", + "rand 0.8.5", "ring", "serde", "serde_json", @@ -1525,7 +2236,7 @@ name = "teaclave_unit_tests" version = "0.5.0" dependencies = [ "anyhow", - "env_logger", + "env_logger 0.7.1", "log", "sgx_types", "teaclave_binder", @@ -1534,6 +2245,22 @@ dependencies = [ "teaclave_types", ] +[[package]] +name = "teaclave_worker" +version = "0.5.0" +dependencies = [ + "anyhow", + "log", + "serde_json", + "sgx_cov", + "sgx_types", + "teaclave_executor", + "teaclave_runtime", + "teaclave_test_utils", + "teaclave_types", + "thiserror", +] + [[package]] name = "tempfile" version = "3.3.0" @@ -1581,11 +2308,20 @@ version = "1.0.38" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1fb327af4685e4d03fa8cbcf1716380da910eeb2bb8be417e7f9fd3fb164f36f" dependencies = [ - "proc-macro2 1.0.49", - "quote 1.0.23", + "proc-macro2 1.0.56", + "quote 1.0.26", "syn 1.0.107", ] +[[package]] +name = "threadpool" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d050e60b33d41c19108b32cea32164033a9013fe3b46cbd4457559bfbf77afaa" +dependencies = [ + "num_cpus", +] + [[package]] name = "tinyvec" version = "1.6.0" @@ -1607,7 +2343,7 @@ version = "1.27.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d0de47a4eecbe11f498978a9b29d792f0d2692d1dd003650c24c76510e3bc001" dependencies = [ - "autocfg", + "autocfg 1.1.0", "bytes", "libc", "mio", @@ -1750,6 +2486,17 @@ dependencies = [ "sha1", ] +[[package]] +name = "value-bag" +version = "1.0.0-alpha.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2209b78d1249f7e6f3293657c9779fe31ced465df091bbd433a1cf88e916ec55" +dependencies = [ + "ctor", + "sval", + "version_check", +] + [[package]] name = "vcpkg" version = "0.2.15" @@ -1803,8 +2550,8 @@ dependencies = [ "bumpalo", "log", "once_cell", - "proc-macro2 1.0.49", - "quote 1.0.23", + "proc-macro2 1.0.56", + "quote 1.0.26", "syn 1.0.107", "wasm-bindgen-shared", ] @@ -1827,7 +2574,7 @@ version = "0.2.83" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "052be0f94026e6cbc75cdefc9bae13fd6052cdcaf532fa6c45e7ae33a1e6c810" dependencies = [ - "quote 1.0.23", + "quote 1.0.26", "wasm-bindgen-macro-support", ] @@ -1837,8 +2584,8 @@ version = "0.2.83" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "07bc0c051dc5f23e307b13285f9d75df86bfdf816c5721e573dec1f9b8aa193c" dependencies = [ - "proc-macro2 1.0.49", - "quote 1.0.23", + "proc-macro2 1.0.56", + "quote 1.0.26", "syn 1.0.107", "wasm-bindgen-backend", "wasm-bindgen-shared", @@ -1873,6 +2620,25 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "webpki" +version = "0.21.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8e38c0608262c46d4a56202ebabdeb094cef7e560ca7a226c6bf055188aa4ea" +dependencies = [ + "ring", + "untrusted", +] + +[[package]] +name = "webpki-roots" +version = "0.21.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aabe153544e473b775453675851ecc86863d2a81d786d741f6b76778f2a48940" +dependencies = [ + "webpki", +] + [[package]] name = "winapi" version = "0.3.9" @@ -2036,3 +2802,14 @@ checksum = "80d0f4e272c85def139476380b12f9ac60926689dd2e01d4923222f40580869d" dependencies = [ "winapi", ] + +[[package]] +name = "yasna" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0de7bff972b4f2a06c85f6d8454b09df153af7e3a4ec2aac81db1b105b684ddb" +dependencies = [ + "bit-vec", + "chrono", + "num-bigint 0.2.6", +] diff --git a/cmake/tomls/Cargo.sgx_untrusted_app.toml b/cmake/tomls/Cargo.sgx_untrusted_app.toml index 017840a9..f41e982f 100644 --- a/cmake/tomls/Cargo.sgx_untrusted_app.toml +++ b/cmake/tomls/Cargo.sgx_untrusted_app.toml @@ -38,7 +38,14 @@ exclude = [ [patch.crates-io] # We cannot remove these crates, because proto crates depend on them sgx_crypto = { path = "../../../third_party/rust-sgx-sdk/sgx_crypto" } +sgx_cov = { path = "../../../third_party/rust-sgx-sdk/sgx_tests/cov" } +sgx_libc = { path = "../../../third_party/rust-sgx-sdk/sgx_libc" } +sgx_macros = { path = "../../../third_party/rust-sgx-sdk/sgx_macros" } +sgx_rand = { path = "../../../third_party/rust-sgx-sdk/sgx_rand" } sgx_tprotected_fs = { path = "../../../third_party/rust-sgx-sdk/sgx_protected_fs/tfs" } sgx_tse = { path = "../../../third_party/rust-sgx-sdk/sgx_tse" } sgx_types = { path = "../../../third_party/rust-sgx-sdk/sgx_types" } sgx_urts = { path = "../../../third_party/rust-sgx-sdk/sgx_urts" } + +rustface = { git = "https://github.com/apache/incubator-teaclave-crates" } +rusty-machine = { git = "https://github.com/apache/incubator-teaclave-crates" } \ No newline at end of file diff --git a/cmake/tomls/Cargo.unix_app.lock b/cmake/tomls/Cargo.unix_app.lock index 8e17ccb2..6f0e64fc 100644 --- a/cmake/tomls/Cargo.unix_app.lock +++ b/cmake/tomls/Cargo.unix_app.lock @@ -1856,6 +1856,7 @@ dependencies = [ "chrono", "hex", "httparse", + "libc", "log", "num-bigint", "percent-encoding", @@ -1985,6 +1986,7 @@ dependencies = [ "anyhow", "cfg-if 0.1.10", "http", + "libc", "log", "rustls 0.17.0", "serde", diff --git a/executor/Cargo.toml b/executor/Cargo.toml index 28d7edd7..974273c0 100644 --- a/executor/Cargo.toml +++ b/executor/Cargo.toml @@ -36,6 +36,13 @@ mesalock_sgx = [ "teaclave_function/mesalock_sgx", "teaclave_executor_context/mesalock_sgx", ] +app = [ + "teaclave_types/app", + "teaclave_crypto/app", + "teaclave_runtime/app", + "teaclave_function/app", + "teaclave_executor_context/app", +] cov = ["sgx_cov"] enclave_unit_test = [ "teaclave_test_utils/mesalock_sgx", diff --git a/executor/context/Cargo.toml b/executor/context/Cargo.toml index 5d41b928..b40bd7c6 100644 --- a/executor/context/Cargo.toml +++ b/executor/context/Cargo.toml @@ -29,6 +29,11 @@ crate-type = ["staticlib", "rlib"] [features] default = [] +app = [ + "teaclave_types/app", + "teaclave_crypto/app", + "teaclave_runtime/app", +] mesalock_sgx = [ "teaclave_types/mesalock_sgx", "teaclave_crypto/mesalock_sgx", diff --git a/executor/context/src/context.rs b/executor/context/src/context.rs index ccccc199..8970c5f3 100644 --- a/executor/context/src/context.rs +++ b/executor/context/src/context.rs @@ -15,7 +15,6 @@ // specific language governing permissions and limitations // under the License. -#[cfg(feature = "mesalock_sgx")] use std::cell::RefCell; use std::slice; use std::thread_local; diff --git a/executor/src/lib.rs b/executor/src/lib.rs index 60fbcfcb..872880bf 100644 --- a/executor/src/lib.rs +++ b/executor/src/lib.rs @@ -20,14 +20,14 @@ extern crate sgx_types; #[cfg(executor_builtin)] mod builtin; -#[cfg(executor_mesapy)] +#[cfg(all(executor_mesapy, not(feature = "app")))] mod mesapy; #[cfg(executor_wamr)] mod wamr; #[cfg(executor_builtin)] pub use builtin::BuiltinFunctionExecutor; -#[cfg(executor_mesapy)] +#[cfg(all(executor_mesapy, not(feature = "app")))] pub use mesapy::MesaPy; #[cfg(executor_wamr)] pub use wamr::WAMicroRuntime; @@ -39,7 +39,7 @@ pub mod tests { #[allow(clippy::vec_init_then_push)] pub fn run_tests() -> bool { let mut v: Vec<bool> = Vec::new(); - #[cfg(executor_mesapy)] + #[cfg(all(executor_mesapy, not(feature = "app")))] v.push(mesapy::tests::run_tests()); #[cfg(executor_builtin)] v.push(builtin::tests::run_tests()); diff --git a/file_agent/src/agent.rs b/file_agent/src/agent.rs index 650f47a6..b9313aa7 100644 --- a/file_agent/src/agent.rs +++ b/file_agent/src/agent.rs @@ -97,6 +97,7 @@ async fn handle_download( download_remote_input_to_file(remote, dst).await?; } "file" => { + // Note: For LibOS, the file path must be inside the LibOS's file system let src = remote .to_file_path() .map_err(|e| anyhow::anyhow!("Cannot convert file:// to path: {:?}", e))?; @@ -191,7 +192,7 @@ async fn handle_upload(info: HandleFileInfo, fusion_base: impl AsRef<Path>) -> a Ok(()) } -fn handle_file_request(bytes: &[u8]) -> anyhow::Result<()> { +pub fn handle_file_request(bytes: &[u8]) -> anyhow::Result<()> { let req: FileAgentRequest = serde_json::from_slice(bytes)?; let results = tokio::runtime::Builder::new_multi_thread() .enable_all() diff --git a/file_agent/src/lib.rs b/file_agent/src/lib.rs index 0dd97b24..40dc91fa 100644 --- a/file_agent/src/lib.rs +++ b/file_agent/src/lib.rs @@ -19,4 +19,4 @@ extern crate log; mod agent; -pub use agent::ocall_handle_file_request; +pub use agent::{handle_file_request, ocall_handle_file_request}; diff --git a/function/Cargo.toml b/function/Cargo.toml index 321d3209..a4fe6851 100644 --- a/function/Cargo.toml +++ b/function/Cargo.toml @@ -29,6 +29,12 @@ crate-type = ["staticlib", "rlib"] [features] default = [] +app = [ + "teaclave_types/app", + "teaclave_crypto/app", + "teaclave_runtime/app", + "teaclave_executor_context/app", +] mesalock_sgx = [ "teaclave_types/mesalock_sgx", "teaclave_crypto/mesalock_sgx", diff --git a/logger/Cargo.toml b/logger/Cargo.toml index 8754198a..0b30858e 100644 --- a/logger/Cargo.toml +++ b/logger/Cargo.toml @@ -28,7 +28,7 @@ name = "teaclave_logger" crate-type = ["staticlib", "rlib"] [features] -default = ["mesalock_sgx"] +default = [] mesalock_sgx = [] cov = ["sgx_cov"] enclave_unit_test = ["teaclave_test_utils/mesalock_sgx"] diff --git a/rpc/Cargo.toml b/rpc/Cargo.toml index 9c51f1b4..0363b994 100644 --- a/rpc/Cargo.toml +++ b/rpc/Cargo.toml @@ -25,6 +25,11 @@ edition = "2021" [features] default = [] +app = [ + "libc", + "teaclave_types/app", + "teaclave_attestation/app" +] mesalock_sgx = [ "sgx_libc", "teaclave_types/mesalock_sgx", @@ -35,6 +40,7 @@ mesalock_sgx = [ anyhow = { version = "1.0.26" } cfg-if = { version = "0.1.9" } http = { version = "0.2" } +libc = { version = "0.2.66", optional = true } log = { version = "0.4.17", features = ["release_max_level_info"] } rustls = { version = "0.17.0", features = ["dangerous_configuration"] } serde = { version = "1.0.92", features = ["derive"] } diff --git a/rpc/src/lib.rs b/rpc/src/lib.rs index e396c16c..69cbc3f3 100644 --- a/rpc/src/lib.rs +++ b/rpc/src/lib.rs @@ -39,6 +39,6 @@ mod protocol; mod request; pub use request::{IntoRequest, Request}; pub use teaclave_rpc_proc_macro::into_request; -#[cfg(feature = "mesalock_sgx")] +#[cfg(any(feature = "mesalock_sgx", feature = "app"))] pub mod server; mod transport; diff --git a/rpc/src/server.rs b/rpc/src/server.rs index 97c1087d..27c3fc7e 100644 --- a/rpc/src/server.rs +++ b/rpc/src/server.rs @@ -19,9 +19,13 @@ use crate::config::SgxTrustedTlsServerConfig; use crate::transport::{ServerTransport, SgxTrustedTlsTransport}; use crate::TeaclaveService; use anyhow::Result; +#[cfg(not(feature = "mesalock_sgx"))] +use libc::setsockopt; use log::{debug, error, warn}; use serde::{Deserialize, Serialize}; +#[cfg(feature = "mesalock_sgx")] use sgx_libc as libc; +#[cfg(feature = "mesalock_sgx")] use sgx_libc::ocall::setsockopt; use std::{io, mem, os::unix::io::AsRawFd}; diff --git a/runtime/Cargo.toml b/runtime/Cargo.toml index 210f3a8c..da1969d3 100644 --- a/runtime/Cargo.toml +++ b/runtime/Cargo.toml @@ -29,6 +29,9 @@ crate-type = ["staticlib", "rlib"] [features] default = [] +app = [ + "teaclave_types/app", +] mesalock_sgx = [ "teaclave_types/mesalock_sgx", ] diff --git a/runtime/src/raw_io.rs b/runtime/src/raw_io.rs index 90475429..2d8da63a 100644 --- a/runtime/src/raw_io.rs +++ b/runtime/src/raw_io.rs @@ -15,9 +15,11 @@ // specific language governing permissions and limitations // under the License. +#[cfg(not(feature = "mesalock_sgx"))] +use std::fs::File; use std::io; +#[cfg(feature = "mesalock_sgx")] use std::untrusted::fs::File; - use teaclave_types::StagedFiles; use teaclave_types::TeaclaveRuntime; diff --git a/services/authentication/enclave/src/user_db.rs b/services/authentication/enclave/src/user_db.rs index 72cd7f5a..75ca29b5 100644 --- a/services/authentication/enclave/src/user_db.rs +++ b/services/authentication/enclave/src/user_db.rs @@ -125,8 +125,7 @@ pub(crate) fn create_persistent_auth_db(base_dir: impl AsRef<Path>) -> DB { let opt = rusty_leveldb::Options::new_disk_db_with(key); let db_path = base_dir.as_ref().join("authentication_db"); log::info!("open auth db: {:?}", db_path); - let database = DB::open(db_path, opt).unwrap(); - database + DB::open(db_path, opt).unwrap() } #[cfg(test_mode)] diff --git a/services/execution/app/Cargo.toml b/services/execution/app/Cargo.toml index 01d5f640..d57cbb3f 100644 --- a/services/execution/app/Cargo.toml +++ b/services/execution/app/Cargo.toml @@ -24,11 +24,23 @@ license = "Apache-2.0" build = "build.rs" edition = "2021" +[features] +default =[] +libos = [ + "teaclave_execution_service_enclave/libos", + "teaclave_config/build_config", + "teaclave_logger" + ] + [dependencies] env_logger = { version = "0.7.1" } anyhow = { version = "1.0.26" } libc = { version = "0.2.66" } +log = { version = "0.4.17", features = ["release_max_level_info"] } signal-hook = { version = "0.1.13" } -teaclave_file_agent = { path = "../../../file_agent" } -teaclave_service_app_utils = { path = "../../utils/service_app_utils" } +teaclave_config = { path = "../../../config" } +teaclave_logger = { path = "../../../logger", optional = true } +teaclave_file_agent = { path = "../../../file_agent" } +teaclave_service_app_utils = { path = "../../utils/service_app_utils" } +teaclave_execution_service_enclave = { path = "../enclave", optional = true } diff --git a/services/execution/app/build.rs b/services/execution/app/build.rs index 39dc9d1b..9a3101ae 100644 --- a/services/execution/app/build.rs +++ b/services/execution/app/build.rs @@ -18,16 +18,7 @@ use std::env; use std::path::PathBuf; -fn choose_sgx_dylib(is_sim: bool) { - if is_sim { - println!("cargo:rustc-link-lib=dylib=sgx_urts_sim"); - println!("cargo:rustc-link-lib=dylib=sgx_uae_service_sim"); - } else { - println!("cargo:rustc-link-lib=dylib=sgx_urts"); - println!("cargo:rustc-link-lib=dylib=sgx_uae_service"); - } -} - +#[cfg(not(feature = "libos"))] fn main() { let sdk_dir = env::var("SGX_SDK").unwrap_or("/opt/intel/sgxsdk".into()); println!("cargo:rustc-link-search=native={}/lib64", sdk_dir); @@ -49,6 +40,19 @@ fn main() { panic!("Stop build process, wrong SGX_MODE env provided."); } }; + if is_sim { + println!("cargo:rustc-link-lib=dylib=sgx_urts_sim"); + println!("cargo:rustc-link-lib=dylib=sgx_uae_service_sim"); + } else { + println!("cargo:rustc-link-lib=dylib=sgx_urts"); + println!("cargo:rustc-link-lib=dylib=sgx_uae_service"); + } +} - choose_sgx_dylib(is_sim); +#[cfg(feature = "libos")] +fn main() { + let out_path = env::var_os("TEACLAVE_OUT_DIR").unwrap_or("out".into()); + let out_dir = &PathBuf::from(out_path); + println!("cargo:rustc-link-search=native={}", out_dir.display()); + println!("cargo:rustc-link-lib=static:+whole-archive=vmlib"); } diff --git a/services/execution/app/src/main.rs b/services/execution/app/src/main.rs index 4482860f..10d7a821 100644 --- a/services/execution/app/src/main.rs +++ b/services/execution/app/src/main.rs @@ -15,14 +15,28 @@ // specific language governing permissions and limitations // under the License. -use anyhow::Result; -use teaclave_service_app_utils::launch_teaclave_service; - -// Use to import ocall -pub use teaclave_file_agent::ocall_handle_file_request; - -const PACKAGE_NAME: &str = env!("CARGO_PKG_NAME"); +#[cfg(feature = "libos")] +fn main() { + let env = env_logger::Env::new() + .filter_or("TEACLAVE_LOG", "RUST_LOG") + .write_style_or("TEACLAVE_LOG_STYLE", "RUST_LOG_STYLE"); + let env_logger = env_logger::Builder::from_env(env).build(); + teaclave_logger::Builder::new() + .secondary_logger(env_logger) + .init(); + // The Absolute path of runtime.config.toml in occlum instance + let config_path = "runtime.config.toml"; + let config = teaclave_config::RuntimeConfig::from_toml(config_path) + .expect("Failed to load config file."); + if let Err(e) = teaclave_execution_service_enclave::start_service(&config) { + log::error!("app will exit, error {:?}", e); + } +} -fn main() -> Result<()> { - launch_teaclave_service(PACKAGE_NAME) +#[cfg(not(feature = "libos"))] +fn main() -> anyhow::Result<()> { + // Use to import ocall + pub use teaclave_file_agent::ocall_handle_file_request; + const PACKAGE_NAME: &str = env!("CARGO_PKG_NAME"); + teaclave_service_app_utils::launch_teaclave_service(PACKAGE_NAME) } diff --git a/services/execution/enclave/Cargo.toml b/services/execution/enclave/Cargo.toml index 8c18a832..32d58cbb 100644 --- a/services/execution/enclave/Cargo.toml +++ b/services/execution/enclave/Cargo.toml @@ -41,6 +41,18 @@ mesalock_sgx = [ "teaclave_config/build_config", "teaclave_worker/mesalock_sgx", ] +libos = [ + "teaclave_attestation/libos", + "teaclave_binder/app", + "teaclave_config/build_config", + "teaclave_crypto/app", + "teaclave_file_agent", + "teaclave_proto/app", + "teaclave_rpc/app", + "teaclave_service_enclave_utils/libos", + "teaclave_types/app", + "teaclave_worker/app", +] cov = ["teaclave_service_enclave_utils/cov"] enclave_unit_test = ["teaclave_binder/enclave_unit_test", "teaclave_test_utils/mesalock_sgx"] @@ -63,7 +75,8 @@ teaclave_service_enclave_utils = { path = "../../utils/service_enclave_utils" } teaclave_types = { path = "../../../types" } teaclave_crypto = { path = "../../../crypto" } teaclave_worker = { path = "../../../worker" } -teaclave_test_utils = { path = "../../../tests/utils" , optional = true } +teaclave_test_utils = { path = "../../../tests/utils", optional = true } +teaclave_file_agent = { path = "../../../file_agent", optional = true } sgx_cov = { version = "2.0.0", optional = true } diff --git a/services/execution/enclave/src/ecall.rs b/services/execution/enclave/src/ecall.rs new file mode 100644 index 00000000..a6a68d2d --- /dev/null +++ b/services/execution/enclave/src/ecall.rs @@ -0,0 +1,55 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +use teaclave_binder::proto::{ + ECallCommand, FinalizeEnclaveInput, FinalizeEnclaveOutput, InitEnclaveInput, InitEnclaveOutput, + StartServiceInput, StartServiceOutput, +}; +use teaclave_binder::{handle_ecall, register_ecall_handler}; +use teaclave_service_enclave_utils::ServiceEnclave; +use teaclave_types::{TeeServiceError, TeeServiceResult}; + +#[handle_ecall] +fn handle_start_service(input: &StartServiceInput) -> TeeServiceResult<StartServiceOutput> { + match super::start_service(&input.config) { + Ok(_) => Ok(StartServiceOutput), + // terminate the enclave for executor + Err(e) => { + log::error!("Service shutdown, reason: {}", e); + Err(TeeServiceError::EnclaveForceTermination) + } + } +} + +#[handle_ecall] +fn handle_init_enclave(_: &InitEnclaveInput) -> TeeServiceResult<InitEnclaveOutput> { + ServiceEnclave::init(env!("CARGO_PKG_NAME"))?; + Ok(InitEnclaveOutput) +} + +#[handle_ecall] +fn handle_finalize_enclave(_: &FinalizeEnclaveInput) -> TeeServiceResult<FinalizeEnclaveOutput> { + ServiceEnclave::finalize()?; + Ok(FinalizeEnclaveOutput) +} + +register_ecall_handler!( + type ECallCommand, + (ECallCommand::StartService, StartServiceInput, StartServiceOutput), + (ECallCommand::InitEnclave, InitEnclaveInput, InitEnclaveOutput), + (ECallCommand::FinalizeEnclave, FinalizeEnclaveInput, FinalizeEnclaveOutput), +); diff --git a/services/execution/enclave/src/ocall.rs b/services/execution/enclave/src/file_handler.rs similarity index 82% rename from services/execution/enclave/src/ocall.rs rename to services/execution/enclave/src/file_handler.rs index c542b124..d1c5e252 100644 --- a/services/execution/enclave/src/ocall.rs +++ b/services/execution/enclave/src/file_handler.rs @@ -15,28 +15,34 @@ // specific language governing permissions and limitations // under the License. -use anyhow::ensure; use anyhow::Result; +#[cfg(feature = "mesalock_sgx")] use sgx_types::error::SgxStatus; use teaclave_types::FileAgentRequest; +#[cfg(feature = "mesalock_sgx")] extern "C" { fn ocall_handle_file_request(p_retval: *mut u32, in_buf: *const u8, in_len: u32) -> SgxStatus; } -#[allow(dead_code)] +#[cfg(feature = "mesalock_sgx")] pub(crate) fn handle_file_request(request: FileAgentRequest) -> Result<()> { let mut rt: u32 = 2; let bytes = serde_json::to_vec(&request)?; let buf_len = bytes.len(); let res = unsafe { ocall_handle_file_request(&mut rt as _, bytes.as_ptr() as _, buf_len as u32) }; - - ensure!(res == SgxStatus::Success, "ocall sgx_error = {:?}", res); - ensure!(rt == 0, "ocall error = {:?}", rt); + anyhow::ensure!(res == SgxStatus::Success, "ocall sgx_error = {:?}", res); + anyhow::ensure!(rt == 0, "ocall error = {:?}", rt); Ok(()) } +#[cfg(not(feature = "mesalock_sgx"))] +pub(crate) fn handle_file_request(request: FileAgentRequest) -> Result<()> { + let bytes = serde_json::to_vec(&request)?; + teaclave_file_agent::handle_file_request(&bytes) +} + #[cfg(feature = "enclave_unit_test")] pub mod tests { use super::*; diff --git a/services/execution/enclave/src/lib.rs b/services/execution/enclave/src/lib.rs index e9d9ce6d..7f092ce5 100644 --- a/services/execution/enclave/src/lib.rs +++ b/services/execution/enclave/src/lib.rs @@ -18,29 +18,25 @@ #![feature(strict_provenance)] extern crate sgx_types; - +#[cfg(feature = "mesalock_sgx")] use std::untrusted::path::PathEx; use anyhow::{anyhow, ensure, Result}; - use log::info; use teaclave_attestation::{verifier, AttestationConfig, RemoteAttestation}; -use teaclave_binder::proto::{ - ECallCommand, FinalizeEnclaveInput, FinalizeEnclaveOutput, InitEnclaveInput, InitEnclaveOutput, - StartServiceInput, StartServiceOutput, -}; -use teaclave_binder::{handle_ecall, register_ecall_handler}; use teaclave_config::build::{AS_ROOT_CA_CERT, AUDITOR_PUBLIC_KEYS}; use teaclave_config::RuntimeConfig; use teaclave_service_enclave_utils::create_trusted_scheduler_endpoint; -use teaclave_service_enclave_utils::ServiceEnclave; -use teaclave_types::{EnclaveInfo, TeeServiceError, TeeServiceResult}; -mod ocall; +use teaclave_types::EnclaveInfo; + +#[cfg(feature = "mesalock_sgx")] +mod ecall; +mod file_handler; mod service; mod task_file_manager; -fn start_service(config: &RuntimeConfig) -> Result<()> { +pub fn start_service(config: &RuntimeConfig) -> Result<()> { info!("Starting Execution..."); let attestation_config = AttestationConfig::from_teaclave_config(config)?; @@ -68,8 +64,10 @@ fn start_service(config: &RuntimeConfig) -> Result<()> { // We only create this base directory in test_mode // This directory should be mounted in release mode - #[cfg(test_mode)] + #[cfg(all(test_mode, feature = "mesalock_sgx"))] std::untrusted::fs::create_dir_all(&fusion_base)?; + #[cfg(all(test_mode, not(feature = "mesalock_sgx")))] + std::fs::create_dir_all(&fusion_base)?; ensure!( fusion_base.exists(), @@ -84,37 +82,6 @@ fn start_service(config: &RuntimeConfig) -> Result<()> { service.start() } -#[handle_ecall] -fn handle_start_service(input: &StartServiceInput) -> TeeServiceResult<StartServiceOutput> { - match start_service(&input.config) { - Ok(_) => Ok(StartServiceOutput), - // terminate the enclave for executor - Err(e) => { - log::error!("Service shutdown, reason: {}", e); - Err(TeeServiceError::EnclaveForceTermination) - } - } -} - -#[handle_ecall] -fn handle_init_enclave(_: &InitEnclaveInput) -> TeeServiceResult<InitEnclaveOutput> { - ServiceEnclave::init(env!("CARGO_PKG_NAME"))?; - Ok(InitEnclaveOutput) -} - -#[handle_ecall] -fn handle_finalize_enclave(_: &FinalizeEnclaveInput) -> TeeServiceResult<FinalizeEnclaveOutput> { - ServiceEnclave::finalize()?; - Ok(FinalizeEnclaveOutput) -} - -register_ecall_handler!( - type ECallCommand, - (ECallCommand::StartService, StartServiceInput, StartServiceOutput), - (ECallCommand::InitEnclave, InitEnclaveInput, InitEnclaveOutput), - (ECallCommand::FinalizeEnclave, FinalizeEnclaveInput, FinalizeEnclaveOutput), -); - #[cfg(feature = "enclave_unit_test")] pub mod tests { use super::*; @@ -122,7 +89,7 @@ pub mod tests { pub fn run_tests() -> bool { run_tests!( - ocall::tests::test_handle_file_request, + file_handler::tests::test_handle_file_request, service::tests::test_invoke_echo, service::tests::test_invoke_gbdt_train, task_file_manager::tests::test_input, diff --git a/services/execution/enclave/src/task_file_manager.rs b/services/execution/enclave/src/task_file_manager.rs index cf1de704..154fdd0f 100644 --- a/services/execution/enclave/src/task_file_manager.rs +++ b/services/execution/enclave/src/task_file_manager.rs @@ -15,12 +15,15 @@ // specific language governing permissions and limitations // under the License. -use crate::ocall::handle_file_request; +use crate::file_handler::handle_file_request; use anyhow::Result; use std::collections::HashMap; +#[cfg(not(feature = "mesalock_sgx"))] +use std::fs; use std::path::Path; use std::path::PathBuf; -use std::untrusted::path::PathEx; +#[cfg(feature = "mesalock_sgx")] +use std::untrusted::{fs, path::PathEx}; use teaclave_crypto::TeaclaveFile128Key; use teaclave_types::*; use url::Url; @@ -117,7 +120,7 @@ impl InterInput { let dst = &self.staged_path; let staged_file_info = match self.file.crypto_info { FileCrypto::TeaclaveFile128(crypto) => { - std::untrusted::fs::soft_link(src, dst)?; + std::os::unix::fs::symlink(src, dst)?; StagedFileInfo::new(src, crypto, self.file.cmac) } FileCrypto::AesGcm128(crypto) => { @@ -288,7 +291,7 @@ fn make_staged_path(base: impl AsRef<Path>, funiq_key: &str, url: &Url) -> Resul let staged_dir = format!("{}-{}", funiq_key, "staged"); let file_dir = base.as_ref().to_owned().join(&staged_dir); if !file_dir.exists() { - std::untrusted::fs::create_dir_all(&file_dir)?; + fs::create_dir_all(&file_dir)?; } let local_dest = file_dir.join(original_name); Ok(local_dest) @@ -303,7 +306,7 @@ fn make_intermediate_path(base: impl AsRef<Path>, funiq_key: &str, url: &Url) -> let file_dir = base.as_ref().to_owned().join(funiq_key); if !file_dir.exists() { - std::untrusted::fs::create_dir_all(&file_dir)?; + fs::create_dir_all(&file_dir)?; } let local_dest = file_dir.join(original_name); Ok(local_dest) diff --git a/services/proto/Cargo.toml b/services/proto/Cargo.toml index b480c4bb..d0f8783a 100644 --- a/services/proto/Cargo.toml +++ b/services/proto/Cargo.toml @@ -25,6 +25,11 @@ edition = "2021" [features] default = [] +app = [ + "teaclave_types/app", + "teaclave_rpc/app", + "teaclave_crypto/app", +] mesalock_sgx = [ "teaclave_types/mesalock_sgx", "teaclave_rpc/mesalock_sgx", diff --git a/services/storage/enclave/src/lib.rs b/services/storage/enclave/src/lib.rs index 948bd8af..dabe7859 100644 --- a/services/storage/enclave/src/lib.rs +++ b/services/storage/enclave/src/lib.rs @@ -109,8 +109,7 @@ fn start_service(config: &RuntimeConfig) -> Result<()> { #[cfg(not(test_mode))] pub(crate) fn create_teaclave_db() -> DB { let opt = rusty_leveldb::in_memory(); - let database = DB::open("teaclave_db", opt).expect("cannot open teaclave_db"); - database + DB::open("teaclave_db", opt).expect("cannot open teaclave_db") } #[cfg(test_mode)] diff --git a/services/utils/service_enclave_utils/Cargo.toml b/services/utils/service_enclave_utils/Cargo.toml index 012f2f2f..670f6202 100644 --- a/services/utils/service_enclave_utils/Cargo.toml +++ b/services/utils/service_enclave_utils/Cargo.toml @@ -30,6 +30,11 @@ mesalock_sgx = [ "teaclave_attestation/mesalock_sgx", "teaclave_rpc/mesalock_sgx", ] +libos = [ + "teaclave_attestation/libos", + "teaclave_rpc/app", + "teaclave_types/app", +] cov = ["sgx_cov", "sgx_macros"] [dependencies] diff --git a/services/utils/service_enclave_utils/src/lib.rs b/services/utils/service_enclave_utils/src/lib.rs index 3be3e4bf..0c16a4eb 100644 --- a/services/utils/service_enclave_utils/src/lib.rs +++ b/services/utils/service_enclave_utils/src/lib.rs @@ -23,17 +23,18 @@ extern crate sgx_trts; use anyhow::Result; use log::debug; use log::error; -use std::backtrace; +#[cfg(not(feature = "mesalock_sgx"))] +use std::fs; use std::path::PathBuf; use std::sync::{Arc, RwLock}; #[cfg(feature = "mesalock_sgx")] -use std::untrusted::path::PathEx; +use std::untrusted::{fs, path::PathEx}; use teaclave_attestation::verifier::AttestationReportVerificationFn; use teaclave_attestation::AttestedTlsConfig; use teaclave_config::RuntimeConfig; use teaclave_rpc::config::SgxTrustedTlsClientConfig; use teaclave_rpc::endpoint::Endpoint; -use teaclave_types::{EnclaveInfo, TeeServiceError, TeeServiceResult}; +use teaclave_types::{EnclaveInfo, TeeServiceResult}; mod macros; @@ -62,10 +63,10 @@ impl ServiceEnclave { .init(); debug!("Enclave initializing"); - - if backtrace::enable_backtrace(backtrace::PrintFormat::Full).is_err() { + #[cfg(feature = "mesalock_sgx")] + if std::backtrace::enable_backtrace(std::backtrace::PrintFormat::Full).is_err() { error!("Cannot enable backtrace"); - return Err(TeeServiceError::SgxError); + return Err(teaclave_types::TeeServiceError::SgxError); } Ok(()) @@ -98,7 +99,7 @@ fn base_dir(config: &RuntimeConfig, sub_name: &str) -> Result<PathBuf> { // We only create this base directory in test_mode // This directory should be mounted in release mode #[cfg(test_mode)] - std::untrusted::fs::create_dir_all(fusion_base)?; + fs::create_dir_all(fusion_base)?; if !fusion_base.exists() { error!( "Fusion base directory is not mounted: {}", @@ -108,7 +109,7 @@ fn base_dir(config: &RuntimeConfig, sub_name: &str) -> Result<PathBuf> { } let sub_base = fusion_base.join(sub_name); - std::untrusted::fs::create_dir_all(&sub_base)?; + fs::create_dir_all(&sub_base)?; if !sub_base.exists() { error!( diff --git a/worker/Cargo.toml b/worker/Cargo.toml index 8de9a842..b21c7310 100644 --- a/worker/Cargo.toml +++ b/worker/Cargo.toml @@ -29,6 +29,11 @@ crate-type = ["staticlib", "rlib"] [features] default = [] +app = [ + "teaclave_types/app", + "teaclave_executor/app", + "teaclave_runtime/app" +] mesalock_sgx = [ "teaclave_types/mesalock_sgx", "teaclave_executor/mesalock_sgx", diff --git a/worker/src/worker.rs b/worker/src/worker.rs index 4334dbef..5a15ffbf 100644 --- a/worker/src/worker.rs +++ b/worker/src/worker.rs @@ -15,7 +15,6 @@ // specific language governing permissions and limitations // under the License. -#[cfg(feature = "mesalock_sgx")] use std::collections::HashMap; use std::format; @@ -50,7 +49,7 @@ impl Default for Worker { }); // Register supported executors - #[cfg(executor_mesapy)] + #[cfg(all(executor_mesapy, not(feature = "app")))] worker.register_executor((ExecutorType::Python, Executor::MesaPy), || { Box::<MesaPy>::default() }); --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
