Skip to content

Commit 6535a00

Browse files
author
Yu Ding
committed
v0.9.7 release. Provides sgx_tstd::untrusted
1 parent 06936bc commit 6535a00

File tree

91 files changed

+418
-96
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

91 files changed

+418
-96
lines changed

Readme.md

+3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
# Rust SGX SDK
22
Rust SGX SDK helps developers write Intel SGX applications in Rust programming language. [[Paper pdf]](documents/ccsp17.pdf)
33

4+
## v0.9.7 Release
5+
This version provides a new namespace: `sgx_tstd::untrusted`, including `sgx_tstd::untrusted::fs` `sgx_tstd::untrusted::time` and `sgx_tstd::untrusted::path`, providing supports to operation to ocalls in a **untrusted** namespace. The **untrusted** namespace is always enabled no matter `untrusted_*` is set or not. We **urge** the developers to use the `sgx_tstd::untrusted` namespace to port their crates, instead of enabling the `untrusted_` series of features. Also, we renamed the `untrusted_net` feature to `net` for feature name unification. Please refer to [release_notes](release_notes.md) for further details.
6+
47
## v0.9.6 Release
58
This version provides security enhancement for untrusted IO and additional support for monotonic counter. Untrusted IO operations in `sgx_tstd::fs` `sgx_tstd::net` and `sgx_tstd::time` are **DISABLED by default** to reduce the untrusted surface, and can be enabled by features. Trusted time support is moved to `sgx_tservice::sgxtime` and monotonic counter is provided by `sgx_tservice::sgxcounter`. Please refer to [release_notes](release_notes.md) for further details.
69

release_notes.md

+5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
# Rust SGX SDK v0.9.7 Release Notes
2+
**Provide `sgx_tstd::untrusted` namespace** v0.9.7 provides `sgx_tstd::untrusted::{fs,path,time}` which related to ocall functions. They are always enabled no matter `untrusted_fs` or `untrusted_time` feature is enabled or not. The major concern of providing such a namespace is that we want the developer to know they are invoking ocall related functions which brings **untrusted data** into the trusted execution engine. For the best security practice, explicitly importing from `sgx_tstd::untrusted` is better than enabling feature in `Cargo.toml`. We stress that `untrusted_fs` and `untrusted_time` features are designed to be **contingency plans** and should only be enabled when porting an very complex Rust crate to Rust-SGX enclaves.
3+
4+
**Rename feature `untrusted_net` to `net`** `net` is well-known as untrusted and we think `net` is a better choice and similar to current features: `backtrace` and `stdio`.
5+
16
# Rust SGX SDK v0.9.6 Release Notes
27
**Support latest Rust nightly build (nightly-2018-02-05-x86_64-unknown-linux-gnu)**
38

samplecode/backtrace/enclave/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "Backtracesampleenclave"
3-
version = "0.9.6"
3+
version = "0.9.7"
44
authors = ["Baidu"]
55

66
[lib]

samplecode/crypto/enclave/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "Cryptosampleenclave"
3-
version = "0.9.6"
3+
version = "0.9.7"
44
authors = ["Baidu"]
55

66
[lib]

samplecode/file/enclave/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "Filesampleenclave"
3-
version = "0.9.6"
3+
version = "0.9.7"
44
authors = ["Baidu"]
55

66
[lib]

samplecode/hello-rust/app/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "app"
3-
version = "0.9.6"
3+
version = "0.9.7"
44
authors = ["duanran01 <[email protected]>"]
55
build = "build.rs"
66

samplecode/hello-rust/enclave/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "Helloworldsampleenclave"
3-
version = "0.9.6"
3+
version = "0.9.7"
44
authors = ["Baidu"]
55

66
[lib]

samplecode/helloworld/enclave/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "Helloworldsampleenclave"
3-
version = "0.9.6"
3+
version = "0.9.7"
44
authors = ["Baidu"]
55

66
[lib]

samplecode/hugemem/enclave/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "Hugememsampleenclave"
3-
version = "0.9.6"
3+
version = "0.9.7"
44
authors = ["Baidu"]
55

66
[lib]

samplecode/localattestation/attestation/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "attestation"
3-
version = "0.9.6"
3+
version = "0.9.7"
44
authors = ["Baidu"]
55

66
[features]

samplecode/localattestation/enclave1/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "enclave1"
3-
version = "0.9.6"
3+
version = "0.9.7"
44
authors = ["Baidu"]
55

66
[lib]

samplecode/localattestation/enclave2/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "enclave2"
3-
version = "0.9.6"
3+
version = "0.9.7"
44
authors = ["Baidu"]
55

66
[lib]

samplecode/localattestation/enclave3/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "enclave3"
3-
version = "0.9.6"
3+
version = "0.9.7"
44
authors = ["Baidu"]
55

66
[lib]

samplecode/machine-learning/app/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "app"
3-
version = "0.9.6"
3+
version = "0.9.7"
44
authors = ["duanran01 <[email protected]>"]
55
build = "build.rs"
66

samplecode/machine-learning/enclave/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "Machinelearningsampleenclave"
3-
version = "0.9.6"
3+
version = "0.9.7"
44
authors = ["Baidu"]
55

66
[lib]

samplecode/remoteattestation/Application/enclave/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "RAenclave"
3-
version = "0.9.6"
3+
version = "0.9.7"
44
authors = ["Baidu"]
55

66
[lib]

samplecode/sealeddata/enclave/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "Sealdatasampleenclave"
3-
version = "0.9.6"
3+
version = "0.9.7"
44
authors = ["Baidu"]
55

66
[lib]

samplecode/serialize/enclave/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "Serializesampleenclave"
3-
version = "0.9.6"
3+
version = "0.9.7"
44
authors = ["Baidu"]
55

66
[lib]

samplecode/sgxtime/app/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "app"
3-
version = "0.9.6"
3+
version = "0.9.7"
44
authors = ["duanran01 <[email protected]>"]
55
build = "build.rs"
66

samplecode/sgxtime/enclave/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "Sgxtimeenclave"
3-
version = "0.9.6"
3+
version = "0.9.7"
44
authors = ["Baidu"]
55

66
[lib]

samplecode/thread/enclave/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "Threadsampleenclave"
3-
version = "0.9.6"
3+
version = "0.9.7"
44
authors = ["Baidu"]
55

66
[lib]

samplecode/tls/tlsclient/app/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "app"
3-
version = "0.9.6"
3+
version = "0.9.7"
44
authors = ["duanran01 <[email protected]>"]
55
build = "build.rs"
66

samplecode/tls/tlsclient/enclave/Cargo.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "tlsclient"
3-
version = "0.9.6"
3+
version = "0.9.7"
44
authors = ["Baidu"]
55

66
[lib]
@@ -13,7 +13,7 @@ default = []
1313
[target.'cfg(not(target_env = "sgx"))'.dependencies]
1414
sgx_types = { path = "../../../../sgx_types" }
1515
sgx_trts = { path = "../../../../sgx_trts" }
16-
sgx_tstd = { path = "../../../../sgx_tstd", features = ["untrusted_fs", "untrusted_net", "untrusted_time"] }
16+
sgx_tstd = { path = "../../../../sgx_tstd", features = ["net"] }
1717

1818
[dependencies]
1919
rustls = { path = "../../../../third_party/rustls" }

samplecode/tls/tlsclient/enclave/Enclave.edl

-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
enclave {
3333
from "sgx_tstd.edl" import *;
3434
from "sgx_stdio.edl" import *;
35-
from "sgx_backtrace.edl" import *;
3635
from "sgx_net.edl" import *;
3736
from "sgx_time.edl" import *;
3837
from "sgx_tstdc.edl" import *;

samplecode/tls/tlsclient/enclave/Xargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ stage = 1
1010

1111
[dependencies.std]
1212
path = "../../../../xargo/sgx_tstd"
13-
features = ["untrusted_fs", "untrusted_net", "untrusted_time"]
13+
features = ["net"]
1414
stage = 2
1515

1616
[dependencies.sgx_rand]

samplecode/tls/tlsclient/enclave/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ extern crate sgx_tstd as std;
4141
use sgx_types::*;
4242
use std::collections;
4343

44-
use std::fs;
44+
use std::untrusted::fs;
4545
use std::io::BufReader;
4646

4747
use std::ffi::CStr;

samplecode/tls/tlsserver/app/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "app"
3-
version = "0.9.6"
3+
version = "0.9.7"
44
authors = ["duanran01 <[email protected]>"]
55
build = "build.rs"
66

samplecode/tls/tlsserver/enclave/Cargo.toml

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
2-
name = "tlsclient"
3-
version = "0.9.6"
2+
name = "tlsserver"
3+
version = "0.9.7"
44
authors = ["Baidu"]
55

66
[lib]
@@ -13,7 +13,7 @@ default = []
1313
[target.'cfg(not(target_env = "sgx"))'.dependencies]
1414
sgx_types = { path = "../../../../sgx_types" }
1515
sgx_trts = { path = "../../../../sgx_trts" }
16-
sgx_tstd = { path = "../../../../sgx_tstd", features = ["untrusted_fs", "untrusted_net", "untrusted_time"] }
16+
sgx_tstd = { path = "../../../../sgx_tstd", features = ["net"] }
1717

1818
[dependencies]
1919
rustls = { path = "../../../../third_party/rustls" }

samplecode/tls/tlsserver/enclave/Enclave.edl

-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
enclave {
3333
from "sgx_tstd.edl" import *;
3434
from "sgx_stdio.edl" import *;
35-
from "sgx_backtrace.edl" import *;
3635
from "sgx_net.edl" import *;
3736
from "sgx_time.edl" import *;
3837
from "sgx_tstdc.edl" import *;

samplecode/tls/tlsserver/enclave/Xargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ stage = 1
1010

1111
[dependencies.std]
1212
path = "../../../../xargo/sgx_tstd"
13-
features = ["untrusted_fs", "untrusted_net", "untrusted_time"]
13+
features = ["net"]
1414
stage = 2
1515

1616
[dependencies.sgx_rand]

samplecode/tls/tlsserver/enclave/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ extern crate sgx_tstd as std;
4040

4141
use sgx_types::*;
4242

43-
use std::fs;
43+
use std::untrusted::fs;
4444
use std::io::BufReader;
4545

4646
use std::ffi::CStr;

samplecode/unit-test/app/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "app"
3-
version = "0.9.6"
3+
version = "0.9.7"
44
authors = ["duanran01 <[email protected]>"]
55
build = "build.rs"
66

samplecode/unit-test/enclave/Cargo.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "Unittestsampleenclave"
3-
version = "0.9.6"
3+
version = "0.9.7"
44
authors = ["Baidu"]
55

66
[lib]
@@ -12,7 +12,7 @@ default = []
1212

1313
[target.'cfg(not(target_env = "sgx"))'.dependencies]
1414
sgx_types = { path = "../../../sgx_types" }
15-
sgx_tstd = { path = "../../../sgx_tstd", features = ["untrusted_fs", "untrusted_time"] }
15+
sgx_tstd = { path = "../../../sgx_tstd",features = ["untrusted_fs"]}
1616
sgx_tcrypto = { path = "../../../sgx_tcrypto" }
1717
sgx_tunittest = { path = "../../../sgx_tunittest" }
1818
sgx_trts = { path = "../../../sgx_trts" }

samplecode/unit-test/enclave/Xargo.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ stage = 1
1010

1111
[dependencies.std]
1212
path = "../../../xargo/sgx_tstd"
13-
features = ["untrusted_fs", "untrusted_time"]
13+
features = ["untrusted_fs"]
1414
stage = 2
1515

1616
[dependencies.sgx_rand]
@@ -23,4 +23,4 @@ stage = 3
2323

2424
[dependencies.sgx_tunittest]
2525
path = "../../../xargo/sgx_tunittest"
26-
stage = 3
26+
stage = 3

samplecode/unit-test/enclave/src/lib.rs

+2
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,8 @@ fn test_main_entrance() -> sgx_status_t {
134134
test_sgxfs,
135135
// std::fs
136136
test_fs,
137+
// std::fs untrusted mode
138+
test_fs_untrusted_fs_feature_enabled,
137139
// std::time
138140
test_std_time
139141
);

samplecode/unit-test/enclave/src/test_file.rs

+24-2
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@
2828

2929
use sgx_rand::{Rng, StdRng};
3030
use std::sgxfs::{self, SgxFile};
31-
use std::fs::File;
32-
use std::fs::remove_file;
31+
use std::untrusted::fs::File;
32+
use std::untrusted::fs::remove_file;
3333
use std::io::{Read, Write};
3434
use std::string::*;
3535

@@ -116,3 +116,25 @@ pub fn test_fs () {
116116
assert!(f.is_ok());
117117
}
118118
}
119+
120+
pub fn test_fs_untrusted_fs_feature_enabled() {
121+
{
122+
use std::fs;
123+
let f = fs::File::create("foo.txt");
124+
assert!(f.is_ok());
125+
126+
let result = f.unwrap().write_all(b"Hello, world!");
127+
assert!(result.is_ok());
128+
129+
let f = fs::File::open("foo.txt");
130+
assert!(f.is_ok());
131+
132+
let mut s = String::new();
133+
let result = f.unwrap().read_to_string(&mut s);
134+
assert!(result.is_ok());
135+
assert_eq!(s, "Hello, world!");
136+
137+
let f = remove_file("foo.txt");
138+
assert!(f.is_ok());
139+
}
140+
}

samplecode/unit-test/enclave/src/test_time.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use std::time::*;
22
use std::panic;
3-
//use std::thread::sleep;
3+
use std::untrusted::time::{InstantEx, SystemTimeEx};
44

55
pub fn test_std_time() {
66
macro_rules! assert_almost_eq {

samplecode/zlib-lazy-static-sample/app/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "app"
3-
version = "0.9.6"
3+
version = "0.9.7"
44
authors = ["duanran01 <[email protected]>"]
55
build = "build.rs"
66

samplecode/zlib-lazy-static-sample/enclave/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "Zlibsampleenclave"
3-
version = "0.9.6"
3+
version = "0.9.7"
44
authors = ["Baidu"]
55

66
[lib]

sgx_alloc/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "sgx_alloc"
3-
version = "0.9.6"
3+
version = "0.9.7"
44
authors = ["Baidu"]
55

66
[lib]

0 commit comments

Comments
 (0)