teaclave-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ms...@apache.org
Subject [incubator-teaclave] branch develop updated: [config] Drop deprecated service_config
Date Fri, 07 Feb 2020 07:54:22 GMT
This is an automated email from the ASF dual-hosted git repository.

mssun pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/incubator-teaclave.git


The following commit(s) were added to refs/heads/develop by this push:
     new 14f9f9f  [config] Drop deprecated service_config
14f9f9f is described below

commit 14f9f9fac5c92f882e4b814581a128be8ef3ce2b
Author: Mingshen Sun <bob@mssun.me>
AuthorDate: Thu Feb 6 23:34:11 2020 -0800

    [config] Drop deprecated service_config
---
 config/Cargo.toml                     |   8 +--
 config/src/lib.rs                     |   2 +-
 services/execution/enclave/Cargo.toml |   1 -
 utils/service_config/Cargo.toml       |  27 -------
 utils/service_config/src/external.rs  |  64 -----------------
 utils/service_config/src/internal.rs  |  97 -------------------------
 utils/service_config/src/lib.rs       | 130 ----------------------------------
 7 files changed, 4 insertions(+), 325 deletions(-)

diff --git a/config/Cargo.toml b/config/Cargo.toml
index a682325..369bf98 100644
--- a/config/Cargo.toml
+++ b/config/Cargo.toml
@@ -11,10 +11,8 @@ default = []
 mesalock_sgx = ["sgx_tstd"]
 
 [dependencies]
-anyhow     = { version = "1.0.26" }
-lazy_static  = { version = "1.0.2", features = ["spin_no_std"] }
-log          = { version = "0.4.6" }
-serde         = { version = "1.0.92", features = ["derive"] }
-toml         = { version = "0.5.1" }
+anyhow = { version = "1.0.26" }
+serde  = { version = "1.0.92", features = ["derive"] }
+toml   = { version = "0.5.1" }
 
 sgx_tstd = { version = "1.1.0", optional = true }
diff --git a/config/src/lib.rs b/config/src/lib.rs
index 4f58003..4acca84 100644
--- a/config/src/lib.rs
+++ b/config/src/lib.rs
@@ -8,7 +8,7 @@ use std::path::PathBuf;
 
 #[derive(Debug, Serialize, Deserialize)]
 #[serde(rename_all = "snake_case")]
-pub enum ConfigSource {
+pub(crate) enum ConfigSource {
     Path(PathBuf),
 }
 
diff --git a/services/execution/enclave/Cargo.toml b/services/execution/enclave/Cargo.toml
index b286f61..5d3d630 100644
--- a/services/execution/enclave/Cargo.toml
+++ b/services/execution/enclave/Cargo.toml
@@ -33,7 +33,6 @@ serde_json    = { version = "1.0.39" }
 serde         = { version = "1.0.92", features = ["derive"] }
 thiserror     = { version = "1.0.9" }
 gbdt          = { version = "0.1.0", features = ["input", "enable_training"] }
-lazy_static   = { version = "1.0.2", features = ["spin_no_std"] }
 
 teaclave_attestation           = { path = "../../../attestation" }
 teaclave_config                = { path = "../../../config" }
diff --git a/utils/service_config/Cargo.toml b/utils/service_config/Cargo.toml
deleted file mode 100644
index db2b102..0000000
--- a/utils/service_config/Cargo.toml
+++ /dev/null
@@ -1,27 +0,0 @@
-[package]
-name = "teaclave_service_config"
-version = "0.1.0"
-authors = ["Teaclave Contributors <dev@teaclave.apache.org>"]
-description = "Teaclave service config"
-license = "Apache-2.0"
-edition = "2018"
-
-[features]
-default = []
-mesalock_sgx = [
-    "sgx_tstd",
-    "teaclave_config/mesalock_sgx",
-    "teaclave_attestation/mesalock_sgx"
-]
-
-[dependencies]
-env_logger   = { version = "0.7.1" }
-anyhow       = { version = "1.0.26" }
-log          = { version = "0.4.6" }
-lazy_static  = { version = "1.0.2", features = ["spin_no_std"] }
-
-teaclave_config      = { path = "../../config" }
-teaclave_attestation = { path = "../../attestation" }
-teaclave_types       = { path = "../../types" }
-
-sgx_tstd  = { version = "1.1.0", features = ["net", "backtrace"], optional = true }
diff --git a/utils/service_config/src/external.rs b/utils/service_config/src/external.rs
deleted file mode 100644
index 935e83f..0000000
--- a/utils/service_config/src/external.rs
+++ /dev/null
@@ -1,64 +0,0 @@
-// 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 super::get_trusted_enclave_attr;
-use super::runtime_config;
-use super::ServiceConfig;
-use super::{InboundDesc, OutboundDesc, TargetDesc};
-
-pub struct External;
-impl External {
-    pub fn frontend() -> ServiceConfig {
-        ServiceConfig::new(
-            runtime_config().api_endpoints.frontend.listen_address,
-            InboundDesc::External,
-        )
-    }
-    pub fn authentication() -> ServiceConfig {
-        ServiceConfig::new(
-            runtime_config().api_endpoints.authentication.listen_address,
-            InboundDesc::External,
-        )
-    }
-    pub fn tms() -> ServiceConfig {
-        ServiceConfig::new(
-            runtime_config().api_endpoints.tms.listen_address,
-            InboundDesc::External,
-        )
-    }
-
-    pub fn fns() -> ServiceConfig {
-        ServiceConfig::new(
-            runtime_config().api_endpoints.fns.listen_address,
-            InboundDesc::External,
-        )
-    }
-
-    pub fn tdfs() -> ServiceConfig {
-        ServiceConfig::new(
-            runtime_config().api_endpoints.tdfs.listen_address,
-            InboundDesc::External,
-        )
-    }
-
-    pub fn target_fns() -> TargetDesc {
-        TargetDesc::new(
-            runtime_config().api_endpoints.fns.advertised_address,
-            OutboundDesc::Sgx(get_trusted_enclave_attr(vec!["fns"])),
-        )
-    }
-}
diff --git a/utils/service_config/src/internal.rs b/utils/service_config/src/internal.rs
deleted file mode 100644
index 14f84c4..0000000
--- a/utils/service_config/src/internal.rs
+++ /dev/null
@@ -1,97 +0,0 @@
-// 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 super::get_trusted_enclave_attr;
-use super::runtime_config;
-use super::InboundDesc;
-use super::OutboundDesc;
-use super::ServiceConfig;
-use super::TargetDesc;
-
-pub struct Internal;
-impl Internal {
-    pub fn tms() -> ServiceConfig {
-        ServiceConfig::new(
-            runtime_config().internal_endpoints.tms.listen_address,
-            InboundDesc::Sgx(get_trusted_enclave_attr(vec!["fns"])),
-        )
-    }
-
-    pub fn kms() -> ServiceConfig {
-        ServiceConfig::new(
-            runtime_config().internal_endpoints.kms.listen_address,
-            InboundDesc::Sgx(get_trusted_enclave_attr(vec!["fns", "tdfs"])),
-        )
-    }
-
-    pub fn tdfs() -> ServiceConfig {
-        ServiceConfig::new(
-            runtime_config().internal_endpoints.tdfs.listen_address,
-            InboundDesc::Sgx(get_trusted_enclave_attr(vec!["fns", "tms"])),
-        )
-    }
-
-    pub fn acs() -> ServiceConfig {
-        ServiceConfig::new(
-            runtime_config().internal_endpoints.acs.listen_address,
-            InboundDesc::Sgx(get_trusted_enclave_attr(vec!["kms", "tms", "tdfs"])),
-        )
-    }
-
-    pub fn dbs() -> ServiceConfig {
-        ServiceConfig::new(
-            runtime_config().internal_endpoints.dbs.listen_address,
-            InboundDesc::External,
-        )
-    }
-
-    pub fn execution_service() -> ServiceConfig {
-        ServiceConfig::new(
-            runtime_config().internal_endpoints.execution.listen_address,
-            // Todo: fix after introducing agent
-            InboundDesc::External,
-        )
-    }
-
-    pub fn target_tms() -> TargetDesc {
-        TargetDesc::new(
-            runtime_config().internal_endpoints.tms.advertised_address,
-            OutboundDesc::Sgx(get_trusted_enclave_attr(vec!["tms"])),
-        )
-    }
-
-    pub fn target_kms() -> TargetDesc {
-        TargetDesc::new(
-            runtime_config().internal_endpoints.kms.advertised_address,
-            OutboundDesc::Sgx(get_trusted_enclave_attr(vec!["kms"])),
-        )
-    }
-
-    pub fn target_tdfs() -> TargetDesc {
-        TargetDesc::new(
-            runtime_config().internal_endpoints.tdfs.advertised_address,
-            OutboundDesc::Sgx(get_trusted_enclave_attr(vec!["tdfs"])),
-        )
-    }
-
-    pub fn target_acs() -> TargetDesc {
-        TargetDesc::new(
-            runtime_config().internal_endpoints.acs.advertised_address,
-            OutboundDesc::Sgx(get_trusted_enclave_attr(vec!["acs"])),
-        )
-    }
-}
diff --git a/utils/service_config/src/lib.rs b/utils/service_config/src/lib.rs
deleted file mode 100644
index 19d3d08..0000000
--- a/utils/service_config/src/lib.rs
+++ /dev/null
@@ -1,130 +0,0 @@
-// 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.
-
-// ip/port is dynamically dispatched for fns client.
-// we cannot use the &'static str in this struct.
-
-#![cfg_attr(feature = "mesalock_sgx", no_std)]
-#[cfg(feature = "mesalock_sgx")]
-#[macro_use]
-extern crate sgx_tstd as std;
-
-use std::net::SocketAddr;
-use std::prelude::v1::*;
-use teaclave_attestation;
-use teaclave_attestation::verifier::EnclaveAttr;
-use teaclave_config::build_config::BUILD_CONFIG;
-use teaclave_config::runtime_config;
-use teaclave_config::runtime_config::RuntimeConfig;
-use teaclave_types::EnclaveInfo;
-use teaclave_types::EnclaveMeasurement;
-
-mod external;
-mod internal;
-pub use external::External;
-pub use internal::Internal;
-
-#[derive(Clone)]
-pub struct TargetDesc {
-    pub addr: SocketAddr,
-    pub desc: OutboundDesc,
-}
-
-impl TargetDesc {
-    pub fn new(addr: SocketAddr, desc: OutboundDesc) -> TargetDesc {
-        TargetDesc { addr, desc }
-    }
-}
-
-#[derive(Clone)]
-pub enum InboundDesc {
-    Sgx(EnclaveAttr),
-    External,
-}
-
-#[derive(Clone)]
-pub enum OutboundDesc {
-    Sgx(EnclaveAttr),
-}
-
-impl OutboundDesc {
-    pub fn default() -> OutboundDesc {
-        OutboundDesc::Sgx(get_trusted_enclave_attr(vec!["fns"]))
-    }
-
-    pub fn new(measures: EnclaveMeasurement) -> OutboundDesc {
-        OutboundDesc::Sgx(EnclaveAttr {
-            measures: vec![measures],
-        })
-    }
-}
-
-pub struct ServiceConfig {
-    pub addr: SocketAddr,
-    pub inbound_desc: InboundDesc, // Trusted
-}
-
-impl ServiceConfig {
-    pub fn new(addr: SocketAddr, inbound_desc: InboundDesc) -> ServiceConfig {
-        ServiceConfig { addr, inbound_desc }
-    }
-}
-
-use lazy_static::lazy_static;
-
-fn load_presigned_enclave_info() -> EnclaveInfo {
-    let audit = &runtime_config().audit;
-    let auditor_signatures_bytes = audit.auditor_signatures_bytes.as_ref().unwrap();
-    let enclave_info_bytes = audit.enclave_info_bytes.as_ref().unwrap();
-    if auditor_signatures_bytes.len() < BUILD_CONFIG.auditor_public_keys.len() {
-        panic!("Number of auditor signatures is not enough for verification.")
-    }
-
-    if !EnclaveInfo::verify_enclave_info(
-        enclave_info_bytes,
-        BUILD_CONFIG.auditor_public_keys,
-        auditor_signatures_bytes,
-    ) {
-        panic!("Failed to verify the signatures of enclave info.");
-    }
-
-    EnclaveInfo::load_enclave_info(enclave_info_bytes)
-}
-
-lazy_static! {
-    static ref RUNTIME_CONFIG: Option<RuntimeConfig> =
-        RuntimeConfig::from_toml("runtime.config.toml");
-    static ref ENCLAVE_IDENTITIES: EnclaveInfo = load_presigned_enclave_info();
-}
-
-pub fn is_runtime_config_initialized() -> bool {
-    RUNTIME_CONFIG.is_some()
-}
-
-pub fn runtime_config() -> &'static RuntimeConfig {
-    RUNTIME_CONFIG
-        .as_ref()
-        .expect("Invalid runtime config, should gracefully exit during enclave_init!")
-}
-
-pub fn get_trusted_enclave_attr(service_names: Vec<&str>) -> EnclaveAttr {
-    let measures = service_names
-        .iter()
-        .map(|name| *ENCLAVE_IDENTITIES.measurements.get(*name).unwrap())
-        .collect();
-    EnclaveAttr { measures }
-}


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@teaclave.apache.org
For additional commands, e-mail: commits-help@teaclave.apache.org


Mime
View raw message