You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@teaclave.apache.org by ms...@apache.org on 2020/01/31 05:01:21 UTC
[incubator-teaclave] branch develop updated (30fbf29 -> 093ee16)
This is an automated email from the ASF dual-hosted git repository.
mssun pushed a change to branch develop
in repository https://gitbox.apache.org/repos/asf/incubator-teaclave.git.
from 30fbf29 [rpc] Handle ProtocolError::SerdeError and send error message to clients
new ab048a0 [build] Temporary comment unused crates in toml to avoid warnings
new 093ee16 [proto] Polish proto implementations
The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
cmake/tomls/Cargo.sgx_trusted_lib.toml | 34 +++++++++++----------
services/frontend/enclave/src/service.rs | 4 +--
services/proto/Cargo.toml | 1 +
.../src/proto/teaclave_frontend_service.proto | 6 ++--
.../proto/src/teaclave_authentication_service.rs | 13 ++++----
services/proto/src/teaclave_common.rs | 3 +-
services/proto/src/teaclave_database_service.rs | 21 +++++++------
services/proto/src/teaclave_frontend_service.rs | 35 +++++++---------------
tests/functional_tests/enclave/Cargo.toml | 1 +
.../enclave/src/teaclave_frontend_service.rs | 10 ++-----
10 files changed, 55 insertions(+), 73 deletions(-)
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@teaclave.apache.org
For additional commands, e-mail: commits-help@teaclave.apache.org
[incubator-teaclave] 02/02: [proto] Polish proto implementations
Posted by ms...@apache.org.
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
commit 093ee1687b276f5ca48cd92374d1c276328f2b08
Author: Mingshen Sun <bo...@mssun.me>
AuthorDate: Thu Jan 30 20:53:28 2020 -0800
[proto] Polish proto implementations
---
services/frontend/enclave/src/service.rs | 4 +--
services/proto/Cargo.toml | 1 +
.../src/proto/teaclave_frontend_service.proto | 6 ++--
.../proto/src/teaclave_authentication_service.rs | 13 ++++----
services/proto/src/teaclave_common.rs | 3 +-
services/proto/src/teaclave_database_service.rs | 21 +++++++------
services/proto/src/teaclave_frontend_service.rs | 35 +++++++---------------
tests/functional_tests/enclave/Cargo.toml | 1 +
.../enclave/src/teaclave_frontend_service.rs | 10 ++-----
9 files changed, 37 insertions(+), 57 deletions(-)
diff --git a/services/frontend/enclave/src/service.rs b/services/frontend/enclave/src/service.rs
index b5fb700..86d9ba1 100644
--- a/services/frontend/enclave/src/service.rs
+++ b/services/frontend/enclave/src/service.rs
@@ -50,7 +50,7 @@ impl TeaclaveFrontend for TeaclaveFrontendService {
request: Request<RegisterInputFileRequest>,
) -> TeaclaveServiceResponseResult<RegisterInputFileResponse> {
match self.authenticate(&request) {
- Ok(r) if r => (),
+ Ok(true) => (),
_ => return Err(TeaclaveFrontendError::AuthenticationError.into()),
}
let response = RegisterInputFileResponse {
@@ -64,7 +64,7 @@ impl TeaclaveFrontend for TeaclaveFrontendService {
request: Request<RegisterOutputFileRequest>,
) -> TeaclaveServiceResponseResult<RegisterOutputFileResponse> {
match self.authenticate(&request) {
- Ok(r) if r => (),
+ Ok(true) => (),
_ => return Err(TeaclaveFrontendError::AuthenticationError.into()),
}
let response = RegisterOutputFileResponse {
diff --git a/services/proto/Cargo.toml b/services/proto/Cargo.toml
index fa3484b..b1d898d 100644
--- a/services/proto/Cargo.toml
+++ b/services/proto/Cargo.toml
@@ -22,6 +22,7 @@ prost = { version = "0.6.0" }
rand = { version = "0.7.0" }
serde = { version = "1.0.39", features = ["derive"] }
serde_json = { version = "1.0.39" }
+url = { version = "2.1.1" }
sgx_cov = { version = "1.1.0", optional = true }
sgx_tstd = { version = "1.1.0", features = ["net", "backtrace"], optional = true }
diff --git a/services/proto/src/proto/teaclave_frontend_service.proto b/services/proto/src/proto/teaclave_frontend_service.proto
index a80daa9..d1b9c39 100644
--- a/services/proto/src/proto/teaclave_frontend_service.proto
+++ b/services/proto/src/proto/teaclave_frontend_service.proto
@@ -5,10 +5,9 @@ package teaclave_frontend_service_proto;
import "teaclave_common.proto";
message RegisterInputFileRequest {
- string uri = 1;
+ string url = 1;
string hash = 2;
teaclave_common_proto.FileCryptoInfo crypto_info = 3;
- teaclave_common_proto.UserCredential credential = 99;
}
message RegisterInputFileResponse {
@@ -16,9 +15,8 @@ message RegisterInputFileResponse {
}
message RegisterOutputFileRequest {
- string uri = 1;
+ string url = 1;
teaclave_common_proto.FileCryptoInfo crypto_info = 2;
- teaclave_common_proto.UserCredential credential = 99;
}
message RegisterOutputFileResponse {
diff --git a/services/proto/src/teaclave_authentication_service.rs b/services/proto/src/teaclave_authentication_service.rs
index 7409c98..dd38701 100644
--- a/services/proto/src/teaclave_authentication_service.rs
+++ b/services/proto/src/teaclave_authentication_service.rs
@@ -1,7 +1,6 @@
use anyhow::anyhow;
use anyhow::{Error, Result};
use core::convert::TryInto;
-use serde::{Deserialize, Serialize};
use crate::teaclave_authentication_service_proto as proto;
use crate::teaclave_common;
@@ -14,32 +13,32 @@ pub use proto::TeaclaveAuthenticationInternalClient;
pub use proto::TeaclaveAuthenticationInternalRequest;
pub use proto::TeaclaveAuthenticationInternalResponse;
-#[derive(Serialize, Deserialize, Debug)]
+#[derive(Debug)]
pub struct UserRegisterRequest {
pub id: std::string::String,
pub password: std::string::String,
}
-#[derive(Serialize, Deserialize, Debug)]
+#[derive(Debug)]
pub struct UserRegisterResponse {}
-#[derive(Serialize, Deserialize, Debug)]
+#[derive(Debug)]
pub struct UserLoginRequest {
pub id: std::string::String,
pub password: std::string::String,
}
-#[derive(Serialize, Deserialize, Debug)]
+#[derive(Debug)]
pub struct UserLoginResponse {
pub token: std::string::String,
}
-#[derive(Serialize, Deserialize, Debug)]
+#[derive(Debug)]
pub struct UserAuthenticateRequest {
pub credential: teaclave_common::UserCredential,
}
-#[derive(Serialize, Deserialize, Debug)]
+#[derive(Debug)]
pub struct UserAuthenticateResponse {
pub accept: bool,
}
diff --git a/services/proto/src/teaclave_common.rs b/services/proto/src/teaclave_common.rs
index cb28604..fe98ec5 100644
--- a/services/proto/src/teaclave_common.rs
+++ b/services/proto/src/teaclave_common.rs
@@ -2,7 +2,6 @@
use std::prelude::v1::*;
use anyhow::{bail, ensure, Error, Result};
-use serde::{Deserialize, Serialize};
use std::format;
use teaclave_types::{
AesGcm128CryptoInfo, AesGcm256CryptoInfo, TeaclaveFileCryptoInfo, TeaclaveFileRootKey128,
@@ -10,7 +9,7 @@ use teaclave_types::{
use crate::teaclave_common_proto as proto;
-#[derive(Serialize, Deserialize, Debug)]
+#[derive(Debug)]
pub struct UserCredential {
pub id: std::string::String,
pub token: std::string::String,
diff --git a/services/proto/src/teaclave_database_service.rs b/services/proto/src/teaclave_database_service.rs
index 9844b0c..db17da5 100644
--- a/services/proto/src/teaclave_database_service.rs
+++ b/services/proto/src/teaclave_database_service.rs
@@ -1,5 +1,4 @@
use anyhow::{Error, Result};
-use serde::{Deserialize, Serialize};
use std::prelude::v1::*;
use crate::teaclave_database_service_proto as proto;
@@ -8,48 +7,48 @@ pub use proto::TeaclaveDatabaseClient;
pub use proto::TeaclaveDatabaseRequest;
pub use proto::TeaclaveDatabaseResponse;
-#[derive(Serialize, Deserialize, Debug)]
+#[derive(Debug)]
pub struct GetRequest {
pub key: Vec<u8>,
}
-#[derive(Serialize, Deserialize, Debug)]
+#[derive(Debug)]
pub struct GetResponse {
pub value: Vec<u8>,
}
-#[derive(Serialize, Deserialize, Debug)]
+#[derive(Debug)]
pub struct PutRequest {
pub key: Vec<u8>,
pub value: Vec<u8>,
}
-#[derive(Serialize, Deserialize, Debug)]
+#[derive(Debug)]
pub struct PutResponse;
-#[derive(Serialize, Deserialize, Debug)]
+#[derive(Debug)]
pub struct DeleteRequest {
pub key: Vec<u8>,
}
-#[derive(Serialize, Deserialize, Debug)]
+#[derive(Debug)]
pub struct DeleteResponse;
-#[derive(Serialize, Deserialize, Debug)]
+#[derive(Debug)]
pub struct EnqueueRequest {
pub key: Vec<u8>,
pub value: Vec<u8>,
}
-#[derive(Serialize, Deserialize, Debug)]
+#[derive(Debug)]
pub struct EnqueueResponse;
-#[derive(Serialize, Deserialize, Debug)]
+#[derive(Debug)]
pub struct DequeueRequest {
pub key: Vec<u8>,
}
-#[derive(Serialize, Deserialize, Debug)]
+#[derive(Debug)]
pub struct DequeueResponse {
pub value: Vec<u8>,
}
diff --git a/services/proto/src/teaclave_frontend_service.rs b/services/proto/src/teaclave_frontend_service.rs
index 1015392..0a0b40b 100644
--- a/services/proto/src/teaclave_frontend_service.rs
+++ b/services/proto/src/teaclave_frontend_service.rs
@@ -1,37 +1,34 @@
-use crate::teaclave_common;
use crate::teaclave_frontend_service_proto as proto;
use anyhow::anyhow;
use anyhow::{Error, Result};
use core::convert::TryInto;
-use serde::{Deserialize, Serialize};
use teaclave_types::TeaclaveFileCryptoInfo;
+use url::Url;
pub use proto::TeaclaveFrontend;
pub use proto::TeaclaveFrontendClient;
pub use proto::TeaclaveFrontendRequest;
pub use proto::TeaclaveFrontendResponse;
-#[derive(Serialize, Deserialize, Debug)]
+#[derive(Debug)]
pub struct RegisterInputFileRequest {
- pub uri: std::string::String,
+ pub url: Url,
pub hash: std::string::String,
pub crypto_info: TeaclaveFileCryptoInfo,
- pub credential: teaclave_common::UserCredential,
}
-#[derive(Serialize, Deserialize, Debug)]
+#[derive(Debug)]
pub struct RegisterInputFileResponse {
pub data_id: std::string::String,
}
-#[derive(Serialize, Deserialize, Debug)]
+#[derive(Debug)]
pub struct RegisterOutputFileRequest {
- pub uri: std::string::String,
+ pub url: Url,
pub crypto_info: TeaclaveFileCryptoInfo,
- pub credential: teaclave_common::UserCredential,
}
-#[derive(Serialize, Deserialize, Debug)]
+#[derive(Debug)]
pub struct RegisterOutputFileResponse {
pub data_id: std::string::String,
}
@@ -41,16 +38,12 @@ impl std::convert::TryFrom<proto::RegisterInputFileRequest> for RegisterInputFil
fn try_from(proto: proto::RegisterInputFileRequest) -> Result<Self> {
let ret = Self {
- uri: proto.uri,
+ url: Url::parse(&proto.url)?,
hash: proto.hash,
crypto_info: proto
.crypto_info
.ok_or_else(|| anyhow!("missing crypto_info"))?
.try_into()?,
- credential: proto
- .credential
- .ok_or_else(|| anyhow!("missing credential"))?
- .try_into()?,
};
Ok(ret)
@@ -60,10 +53,9 @@ impl std::convert::TryFrom<proto::RegisterInputFileRequest> for RegisterInputFil
impl From<RegisterInputFileRequest> for proto::RegisterInputFileRequest {
fn from(request: RegisterInputFileRequest) -> Self {
Self {
- uri: request.uri,
+ url: request.url.into_string(),
hash: request.hash,
crypto_info: Some(request.crypto_info.into()),
- credential: Some(request.credential.into()),
}
}
}
@@ -91,15 +83,11 @@ impl std::convert::TryFrom<proto::RegisterOutputFileRequest> for RegisterOutputF
fn try_from(proto: proto::RegisterOutputFileRequest) -> Result<Self> {
let ret = Self {
- uri: proto.uri,
+ url: Url::parse(&proto.url)?,
crypto_info: proto
.crypto_info
.ok_or_else(|| anyhow!("missing crypto_info"))?
.try_into()?,
- credential: proto
- .credential
- .ok_or_else(|| anyhow!("missing credential"))?
- .try_into()?,
};
Ok(ret)
@@ -109,9 +97,8 @@ impl std::convert::TryFrom<proto::RegisterOutputFileRequest> for RegisterOutputF
impl From<RegisterOutputFileRequest> for proto::RegisterOutputFileRequest {
fn from(request: RegisterOutputFileRequest) -> Self {
Self {
- uri: request.uri,
+ url: request.url.into_string(),
crypto_info: Some(request.crypto_info.into()),
- credential: Some(request.credential.into()),
}
}
}
diff --git a/tests/functional_tests/enclave/Cargo.toml b/tests/functional_tests/enclave/Cargo.toml
index 1382713..d7cb5c5 100644
--- a/tests/functional_tests/enclave/Cargo.toml
+++ b/tests/functional_tests/enclave/Cargo.toml
@@ -31,6 +31,7 @@ anyhow = { version = "1.0.26" }
serde = { version = "1.0.92" }
serde_json = { version = "1.0.39" }
thiserror = { version = "1.0.9" }
+url = { version = "2.1.1" }
teaclave_attestation = { path = "../../../attestation" }
teaclave_config = { path = "../../../config" }
diff --git a/tests/functional_tests/enclave/src/teaclave_frontend_service.rs b/tests/functional_tests/enclave/src/teaclave_frontend_service.rs
index eb6ba4c..516c488 100644
--- a/tests/functional_tests/enclave/src/teaclave_frontend_service.rs
+++ b/tests/functional_tests/enclave/src/teaclave_frontend_service.rs
@@ -1,9 +1,9 @@
use std::collections::HashMap;
use std::prelude::v1::*;
-use teaclave_proto::teaclave_common::*;
use teaclave_proto::teaclave_frontend_service::*;
use teaclave_rpc::endpoint::Endpoint;
use teaclave_types::*;
+use url::Url;
pub fn run_tests() -> bool {
use teaclave_test_utils::*;
@@ -13,16 +13,12 @@ pub fn run_tests() -> bool {
fn test_register_input_file_authentication_error() {
let request = RegisterInputFileRequest {
- uri: "".to_string(),
- hash: "".to_string(),
+ url: Url::parse("s3://s3.us-west-2.amazonaws.com/mybucket/puppy.jpg.enc?key-id=deadbeefdeadbeef&key=deadbeefdeadbeef").unwrap(),
+ hash: "deadbeefdeadbeef".to_string(),
crypto_info: TeaclaveFileCryptoInfo::AesGcm128(AesGcm128CryptoInfo {
key: [0x90u8; 16],
iv: [0x89u8; 12],
}),
- credential: UserCredential {
- id: "".to_string(),
- token: "".to_string(),
- },
};
let mut metadata = HashMap::new();
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@teaclave.apache.org
For additional commands, e-mail: commits-help@teaclave.apache.org
[incubator-teaclave] 01/02: [build] Temporary comment unused crates
in toml to avoid warnings
Posted by ms...@apache.org.
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
commit ab048a0d65f6f7443d29e9c270478903974eb559
Author: Mingshen Sun <bo...@mssun.me>
AuthorDate: Thu Jan 30 19:09:09 2020 -0800
[build] Temporary comment unused crates in toml to avoid warnings
---
cmake/tomls/Cargo.sgx_trusted_lib.toml | 34 ++++++++++++++++++----------------
1 file changed, 18 insertions(+), 16 deletions(-)
diff --git a/cmake/tomls/Cargo.sgx_trusted_lib.toml b/cmake/tomls/Cargo.sgx_trusted_lib.toml
index 485f7ab..6a0113d 100644
--- a/cmake/tomls/Cargo.sgx_trusted_lib.toml
+++ b/cmake/tomls/Cargo.sgx_trusted_lib.toml
@@ -14,6 +14,8 @@ exclude = [
]
[patch.crates-io]
+# Patched sgx crates to vendored, uncomment below crate when needed.
+
# Rust SGX SDK
sgx_alloc = { git = "https://github.com/apache/teaclave-sgx-sdk", rev = "v1.1.0" }
sgx_build_helper = { git = "https://github.com/apache/teaclave-sgx-sdk", rev = "v1.1.0" }
@@ -25,34 +27,34 @@ sgx_tprotected_fs = { git = "https://github.com/apache/teaclave-sgx-sdk", rev =
sgx_trts = { git = "https://github.com/apache/teaclave-sgx-sdk", rev = "v1.1.0" }
sgx_tse = { git = "https://github.com/apache/teaclave-sgx-sdk", rev = "v1.1.0" }
sgx_tstd = { git = "https://github.com/apache/teaclave-sgx-sdk", rev = "v1.1.0" }
-sgx_tunittest = { git = "https://github.com/apache/teaclave-sgx-sdk", rev = "v1.1.0" }
+# sgx_tunittest = { git = "https://github.com/apache/teaclave-sgx-sdk", rev = "v1.1.0" }
sgx_types = { git = "https://github.com/apache/teaclave-sgx-sdk", rev = "v1.1.0" }
sgx_unwind = { git = "https://github.com/apache/teaclave-sgx-sdk", rev = "v1.1.0" }
# SGX crates
-adler32 = { git = "https://github.com/mesalock-linux/adler32-rs-sgx" }
+# adler32 = { git = "https://github.com/mesalock-linux/adler32-rs-sgx" }
aho-corasick = { git = "https://github.com/mesalock-linux/aho-corasick-sgx" }
base64 = { git = "https://github.com/mesalock-linux/rust-base64-sgx" }
byteorder = { git = "https://github.com/mesalock-linux/byteorder-sgx" }
bytes = { git = "https://github.com/mesalock-linux/bytes-sgx" }
chrono = { git = "https://github.com/mesalock-linux/chrono-sgx" }
-color_quant = { git = "https://github.com/mesalock-linux/color_quant-sgx" }
-crc32fast = { git = "https://github.com/mesalock-linux/rust-crc32fast-sgx" }
-deflate = { git = "https://github.com/mesalock-linux/deflate-rs-sgx", branch = "dev" }
+# color_quant = { git = "https://github.com/mesalock-linux/color_quant-sgx" }
+# crc32fast = { git = "https://github.com/mesalock-linux/rust-crc32fast-sgx" }
+# deflate = { git = "https://github.com/mesalock-linux/deflate-rs-sgx", branch = "dev" }
gbdt = { git = "https://github.com/mesalock-linux/gbdt-rs", branch = "mesatee-sgx" }
getrandom = { git = "https://github.com/mesalock-linux/getrandom-sgx" }
-gif = { git = "https://github.com/mesalock-linux/image-gif-sgx" }
-image = { git = "https://github.com/mesalock-linux/image-sgx" }
-inflate = { git = "https://github.com/mesalock-linux/inflate-sgx" }
+# gif = { git = "https://github.com/mesalock-linux/image-gif-sgx" }
+# image = { git = "https://github.com/mesalock-linux/image-sgx" }
+# inflate = { git = "https://github.com/mesalock-linux/inflate-sgx" }
itoa = { git = "https://github.com/mesalock-linux/itoa-sgx" }
-jpeg-decoder = { git = "https://github.com/mesalock-linux/jpeg-decoder-sgx" }
+# jpeg-decoder = { git = "https://github.com/mesalock-linux/jpeg-decoder-sgx" }
log = { git = "https://github.com/mesalock-linux/log-sgx" }
-lzw = { git = "https://github.com/mesalock-linux/lzw-sgx" }
+# lzw = { git = "https://github.com/mesalock-linux/lzw-sgx" }
num-bigint = { git = "https://github.com/mesalock-linux/num-bigint-sgx" }
num-traits = { git = "https://github.com/mesalock-linux/num-traits-sgx" }
-parity-wasm = { git = "https://github.com/mesalock-linux/parity-wasm-sgx" }
+# parity-wasm = { git = "https://github.com/mesalock-linux/parity-wasm-sgx" }
percent-encoding = { git = "https://github.com/mesalock-linux/rust-url-sgx" }
-png = { git = "https://github.com/mesalock-linux/image-png-sgx" }
+# png = { git = "https://github.com/mesalock-linux/image-png-sgx" }
profiler_builtins = { git = "https://github.com/mesalock-linux/sgx-fake-profiler-builtins" }
prost = { git = "https://github.com/mesalock-linux/prost-sgx" }
quick-error = { git = "https://github.com/mesalock-linux/quick-error-sgx" }
@@ -60,16 +62,16 @@ rand = { git = "https://github.com/mesalock-linux/rand-sgx", tag =
regex = { git = "https://github.com/mesalock-linux/regex-sgx" }
ring = { git = "https://github.com/mesalock-linux/ring-sgx", tag = "v0.16.5" }
rustls = { git = "https://github.com/mesalock-linux/rustls", branch = "mesalock_sgx" }
-rusty-machine = { git = "https://github.com/mesalock-linux/rusty-machine-sgx" }
+# rusty-machine = { git = "https://github.com/mesalock-linux/rusty-machine-sgx" }
sct = { git = "https://github.com/mesalock-linux/sct.rs", branch = "mesalock_sgx" }
serde = { git = "https://github.com/mesalock-linux/serde-sgx" }
serde_derive = { git = "https://github.com/mesalock-linux/serde-sgx" }
serde_json = { git = "https://github.com/mesalock-linux/serde-json-sgx" }
-tiff = { git = "https://github.com/mesalock-linux/image-tiff-sgx" }
+# tiff = { git = "https://github.com/mesalock-linux/image-tiff-sgx" }
toml = { git = "https://github.com/mesalock-linux/toml-rs-sgx" }
uuid = { git = "https://github.com/mesalock-linux/uuid-sgx" }
-wabt = { git = "https://github.com/mesalock-linux/wabt-rs-sgx", branch = "v0.9-core" }
-wasmi = { git = "https://github.com/mesalock-linux/wasmi-sgx" }
+# wabt = { git = "https://github.com/mesalock-linux/wabt-rs-sgx", branch = "v0.9-core" }
+# wasmi = { git = "https://github.com/mesalock-linux/wasmi-sgx" }
webpki = { git = "https://github.com/mesalock-linux/webpki", branch = "mesalock_sgx" }
webpki-roots = { git = "https://github.com/mesalock-linux/webpki-roots", branch = "mesalock_sgx" }
yasna = { git = "https://github.com/mesalock-linux/yasna.rs-sgx" }
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@teaclave.apache.org
For additional commands, e-mail: commits-help@teaclave.apache.org