Skip to content

Commit 378a4f0

Browse files
author
Yu Ding
committed
v1.0.0 release
1 parent 7e4bd7a commit 378a4f0

File tree

690 files changed

+276412
-2636
lines changed

Some content is hidden

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

690 files changed

+276412
-2636
lines changed

LICENSE

+433
Large diffs are not rendered by default.

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+
## v1.0.0 Release
5+
We proudly announce v1.0.0 of rust-sgx-sdk! We port Parity's [Webassembly Interpreter](https://github.com/paritytech/wasmi) to Intel SGX and provide a full functional in-enclave [wasmi sample](samplecode/wasmi), and a [sample solution](samplecode/psi) of two-party private-set-intersection resisting side-channel attacks! From this version, we start to support most recent stable branch of Rust instead of nightly for better stability and future production use. Thus, the [stable branch](https://github.com/baidu/rust-sgx-sdk/tree/rust-stable) of v1.0.0 supports the most recent Rust stable toolchain (1.26.0 stable-2018-05-07), while the master only supports Rust nightly toolchain of nightly-2018-04-11. Please refer to [release_notes](release_notes.md) for further details.
6+
47
## v0.9.8 Release
58
This version provides security updates regards to recent Spectre attacks in Intel SGX, and supports **Rust stable (2018-03-01)** (in branch named 'rust-stable'). It contains support of [Intel SGX SDK 2.1.2](https://download.01.org/intel-sgx/linux-2.1.2/) and a series of API functions to stop speculative execution on demand. In addition, we provide a ported version of [rust-protobuf](https://crates.io/crates/protobuf) v1.4.4. Please refer to [release_notes](release_notes.md) for further details.
69

build_helper/Cargo.toml

+13-5
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,19 @@
11
[package]
2-
name = "build_helper"
2+
name = "sgx_build_helper"
33
version = "0.1.0"
44
authors = ["baidu"]
5+
repository = "https://github.com/baidu/rust-sgx-sdk"
6+
license-file = "LICENSE"
7+
documentation = "https://dingelish.github.io/"
8+
description = "Rust SGX SDK provides the ability to write Intel SGX applications in Rust Programming Language."
9+
10+
include = [
11+
"Cargo.toml",
12+
"Readme.md",
13+
"LICENSE",
14+
"lib.rs",
15+
]
516

617
[lib]
7-
name = "build_helper"
18+
name = "sgx_build_helper"
819
path = "lib.rs"
9-
10-
[dependencies]
11-
filetime = "0.1"

build_helper/LICENSE

+613
Large diffs are not rendered by default.

build_helper/Readme.md

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Note
2+
3+
Please visit our [homepage](https://github.com/baidu/rust-sgx-sdk) for usage. Thanks!

build_helper/lib.rs

+7-12
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,11 @@
1010

1111
#![deny(warnings)]
1212

13-
extern crate filetime;
14-
1513
use std::fs::File;
1614
use std::path::{Path, PathBuf};
1715
use std::process::{Command, Stdio};
1816
use std::{fs, env};
19-
20-
use filetime::FileTime;
17+
use std::time::{SystemTime, UNIX_EPOCH};
2118

2219
/// A helper macro to `unwrap` a result except also print out details like:
2320
///
@@ -137,10 +134,8 @@ pub fn rerun_if_changed_anything_in_dir(dir: &Path) {
137134
}
138135

139136
/// Returns the last-modified time for `path`, or zero if it doesn't exist.
140-
pub fn mtime(path: &Path) -> FileTime {
141-
fs::metadata(path).map(|f| {
142-
FileTime::from_last_modification_time(&f)
143-
}).unwrap_or(FileTime::zero())
137+
pub fn mtime(path: &Path) -> SystemTime {
138+
fs::metadata(path).and_then(|f| f.modified()).unwrap_or(UNIX_EPOCH)
144139
}
145140

146141
/// Returns whether `dst` is up to date given that the file or files in `src`
@@ -157,9 +152,9 @@ pub fn up_to_date(src: &Path, dst: &Path) -> bool {
157152
Err(e) => panic!("source {:?} failed to get metadata: {}", src, e),
158153
};
159154
if meta.is_dir() {
160-
dir_up_to_date(src, &threshold)
155+
dir_up_to_date(src, threshold)
161156
} else {
162-
FileTime::from_last_modification_time(&meta) <= threshold
157+
meta.modified().unwrap_or(UNIX_EPOCH) <= threshold
163158
}
164159
}
165160

@@ -226,13 +221,13 @@ pub fn sanitizer_lib_boilerplate(sanitizer_name: &str) -> Result<NativeLibBoiler
226221
search_path)
227222
}
228223

229-
fn dir_up_to_date(src: &Path, threshold: &FileTime) -> bool {
224+
fn dir_up_to_date(src: &Path, threshold: SystemTime) -> bool {
230225
t!(fs::read_dir(src)).map(|e| t!(e)).all(|e| {
231226
let meta = t!(e.metadata());
232227
if meta.is_dir() {
233228
dir_up_to_date(&e.path(), threshold)
234229
} else {
235-
FileTime::from_last_modification_time(&meta) < *threshold
230+
meta.modified().unwrap_or(UNIX_EPOCH) < threshold
236231
}
237232
})
238233
}

dockerfile/Dockerfile

+14-14
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
FROM ubuntu:16.04
3333
MAINTAINER Yu Ding
3434

35-
RUN apt-get update && apt-get install -y build-essential ocaml automake autoconf libtool wget python libssl-dev libcurl4-openssl-dev protobuf-compiler libprotobuf-dev sudo kmod vim curl git-core libprotobuf-c0-dev libboost-thread-dev libboost-system-dev liblog4cpp5-dev libjsoncpp-dev alien uuid-dev libxml2-dev cmake pkg-config
35+
RUN apt-get update && apt-get install -y build-essential ocaml automake autoconf libtool wget python libssl-dev libcurl4-openssl-dev protobuf-compiler libprotobuf-dev sudo kmod vim curl git-core libprotobuf-c0-dev libboost-thread-dev libboost-system-dev liblog4cpp5-dev libjsoncpp-dev alien uuid-dev libxml2-dev cmake pkg-config expect
3636

3737

3838
# Uncomment the following lines for setup iCls
@@ -46,27 +46,27 @@ RUN apt-get update && apt-get install -y build-essential ocaml automake autoconf
4646
# systemctl enable jhi
4747

4848
RUN mkdir /root/sgx && \
49-
wget -O /root/sgx/sgx_linux_x64_psw_2.1.102.43402.bin https://download.01.org/intel-sgx/linux-2.1.2/ubuntu64-desktop/sgx_linux_x64_psw_2.1.102.43402.bin && \
50-
wget -O /root/sgx/sgx_linux_x64_sdk_2.1.102.43402.bin https://download.01.org/intel-sgx/linux-2.1.2/ubuntu64-desktop/sgx_linux_x64_sdk_2.1.102.43402.bin && \
49+
wget -O /root/sgx/psw.bin https://download.01.org/intel-sgx/linux-2.1.3/ubuntu64-desktop/sgx_linux_x64_psw_2.1.103.44322.bin && \
50+
wget -O /root/sgx/sdk.bin https://download.01.org/intel-sgx/linux-2.1.3/ubuntu64-desktop/sgx_linux_x64_sdk_2.1.103.44322.bin && \
5151
cd /root/sgx && \
52-
chmod +x /root/sgx/sgx_linux_x64_psw_2.1.102.43402.bin && \
53-
/root/sgx/sgx_linux_x64_psw_2.1.102.43402.bin && \
54-
chmod +x /root/sgx/sgx_linux_x64_sdk_2.1.102.43402.bin && \
55-
echo -e 'no\n/opt' | /root/sgx/sgx_linux_x64_sdk_2.1.102.43402.bin && \
52+
chmod +x /root/sgx/psw.bin && \
53+
/root/sgx/psw.bin && \
54+
chmod +x /root/sgx/sdk.bin && \
55+
echo -e 'no\n/opt' | /root/sgx/sdk.bin && \
5656
echo 'source /opt/sgxsdk/environment' >> /root/.bashrc
5757

5858
ADD patch /root/
5959

60-
RUN wget -O /root/sgx_2.1.2.tar.gz https://github.com/intel/linux-sgx/archive/sgx_2.1.2.tar.gz && \
61-
cd /root && tar xzf sgx_2.1.2.tar.gz && \
62-
cd /root/linux-sgx-sgx_2.1.2 && git apply ../patch && \
63-
/root/linux-sgx-sgx_2.1.2/download_prebuilt.sh && \
64-
cd /root/linux-sgx-sgx_2.1.2 && make -j && \
65-
cp /root/linux-sgx-sgx_2.1.2/build/linux/libsgx_tstdc.a /opt/sgxsdk/lib64/libsgx_tstdc.a
60+
RUN wget -O /root/src.tar.gz https://github.com/intel/linux-sgx/archive/sgx_2.1.3.tar.gz && \
61+
cd /root && tar xzf src.tar.gz && \
62+
cd /root/linux-sgx-sgx_2.1.3 && git apply ../patch && \
63+
/root/linux-sgx-sgx_2.1.3/download_prebuilt.sh && \
64+
cd /root/linux-sgx-sgx_2.1.3 && make -j && \
65+
cp /root/linux-sgx-sgx_2.1.3/build/linux/libsgx_tstdc.a /opt/sgxsdk/lib64/libsgx_tstdc.a
6666

6767
RUN wget 'https://static.rust-lang.org/rustup/dist/x86_64-unknown-linux-gnu/rustup-init' -O /root/rustup-init && \
6868
chmod +x /root/rustup-init && \
69-
echo '1' | /root/rustup-init --default-toolchain nightly-2018-03-16 && \
69+
echo '1' | /root/rustup-init --default-toolchain nightly-2018-04-12 && \
7070
echo 'source /root/.cargo/env' >> /root/.bashrc && \
7171
/root/.cargo/bin/rustup component add rust-src && \
7272
/root/.cargo/bin/cargo install xargo && \

dockerfile/experimental/Dockerfile

+18-19
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ RUN apt-get update && \
3535
apt-get install --allow-unauthenticated -y build-essential ocaml automake \
3636
autoconf libtool wget python libssl-dev libcurl4-openssl-dev sudo kmod vim curl \
3737
git-core liblog4cpp5-dev libjsoncpp-dev autoconf make g++ unzip python-dev \
38-
alien uuid-dev libxml2-dev cmake pkg-config g++ unzip
38+
alien uuid-dev libxml2-dev cmake pkg-config g++ unzip expect
3939

4040
RUN mkdir /root/sgx && \
4141
cd /root/sgx && \
@@ -54,32 +54,31 @@ RUN mkdir /root/sgx && \
5454
# cd jhi && mkdir build && cd build && cmake .. && make && make install && \
5555
# systemctl enable jhi
5656

57-
RUN wget -O /root/sgx/sgx_linux_x64_psw_2.1.102.43402.bin https://download.01.org/intel-sgx/linux-2.1.2/ubuntu64-desktop/sgx_linux_x64_psw_2.1.102.43402.bin && \
58-
wget -O /root/sgx/sgx_linux_x64_sdk_2.1.102.43402.bin https://download.01.org/intel-sgx/linux-2.1.2/ubuntu64-desktop/sgx_linux_x64_sdk_2.1.102.43402.bin && \
57+
RUN wget -O /root/sgx/psw.bin https://download.01.org/intel-sgx/linux-2.1.3/ubuntu64-desktop/sgx_linux_x64_psw_2.1.103.44322.bin && \
58+
wget -O /root/sgx/sdk.bin https://download.01.org/intel-sgx/linux-2.1.3/ubuntu64-desktop/sgx_linux_x64_sdk_2.1.103.44322.bin && \
5959
cd /root/sgx && \
60-
chmod +x /root/sgx/sgx_linux_x64_psw_2.1.102.43402.bin && \
61-
/root/sgx/sgx_linux_x64_psw_2.1.102.43402.bin && \
62-
chmod +x /root/sgx/sgx_linux_x64_sdk_2.1.102.43402.bin && \
63-
echo -e 'no\n/opt' | /root/sgx/sgx_linux_x64_sdk_2.1.102.43402.bin && \
60+
chmod +x /root/sgx/psw.bin && \
61+
/root/sgx/psw.bin && \
62+
chmod +x /root/sgx/sdk.bin && \
63+
echo -e 'no\n/opt' | /root/sgx/sdk.bin && \
6464
echo 'source /opt/sgxsdk/environment' >> /root/.bashrc
6565

6666
ADD all.patch /root/
6767

68-
RUN wget -O /root/sgx_2.1.2.tar.gz https://github.com/01org/linux-sgx/archive/sgx_2.1.2.tar.gz && \
69-
cd /root && tar xzf sgx_2.1.2.tar.gz && \
70-
cd /root/linux-sgx-sgx_2.1.2 && patch -t -p1 < ../all.patch && \
71-
/root/linux-sgx-sgx_2.1.2/download_prebuilt.sh && \
72-
cd /root/linux-sgx-sgx_2.1.2 && make -j && \
73-
cp /root/linux-sgx-sgx_2.1.2/build/linux/libsgx_tstdc.a /opt/sgxsdk/lib64/libsgx_tstdc.a && \
74-
cp /root/linux-sgx-sgx_2.1.2/build/linux/aesm_service /opt/intel/sgxpsw/aesm/aesm_service && \
75-
cp /root/linux-sgx-sgx_2.1.2/build/linux/libsgx_uae_service.so /usr/lib/libsgx_uae_service.so
68+
RUN wget -O /root/src.tar.gz https://github.com/intel/linux-sgx/archive/sgx_2.1.3.tar.gz && \
69+
cd /root && tar xzf src.tar.gz && \
70+
cd /root/linux-sgx-sgx_2.1.3 && patch -t -p1 < ../all.patch && \
71+
/root/linux-sgx-sgx_2.1.3/download_prebuilt.sh && \
72+
cd /root/linux-sgx-sgx_2.1.3 && make -j && \
73+
cp /root/linux-sgx-sgx_2.1.3/build/linux/libsgx_tstdc.a /opt/sgxsdk/lib64/libsgx_tstdc.a && \
74+
cp /root/linux-sgx-sgx_2.1.3/build/linux/aesm_service /opt/intel/sgxpsw/aesm/aesm_service && \
75+
cp /root/linux-sgx-sgx_2.1.3/build/linux/libsgx_uae_service.so /usr/lib/libsgx_uae_service.so
7676

7777
RUN wget 'https://static.rust-lang.org/rustup/dist/x86_64-unknown-linux-gnu/rustup-init' -O /root/rustup-init && \
7878
chmod +x /root/rustup-init && \
79-
echo '1' | /root/rustup-init --default-toolchain nightly-2018-03-16 && \
79+
echo '1' | /root/rustup-init --default-toolchain nightly-2018-04-12 && \
8080
echo 'source /root/.cargo/env' >> /root/.bashrc && \
8181
/root/.cargo/bin/rustup component add rust-src && \
82-
apt-get autoclean && apt-get autoremove && rm -rf /var/cache/apt/archives/* && \
83-
/root/.cargo/bin/cargo install xargo
84-
82+
/root/.cargo/bin/cargo install xargo && \
83+
apt-get autoclean && apt-get autoremove && rm -rf /var/cache/apt/archives/*
8584
WORKDIR /root

dockerfile/rust-stable/Dockerfile

+14-14
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
FROM ubuntu:16.04
3333
MAINTAINER Yu Ding
3434

35-
RUN apt-get update && apt-get install -y build-essential ocaml automake autoconf libtool wget python libssl-dev libcurl4-openssl-dev protobuf-compiler libprotobuf-dev sudo kmod vim curl git-core libprotobuf-c0-dev libboost-thread-dev libboost-system-dev liblog4cpp5-dev libjsoncpp-dev alien uuid-dev libxml2-dev cmake pkg-config
35+
RUN apt-get update && apt-get install -y build-essential ocaml automake autoconf libtool wget python libssl-dev libcurl4-openssl-dev protobuf-compiler libprotobuf-dev sudo kmod vim curl git-core libprotobuf-c0-dev libboost-thread-dev libboost-system-dev liblog4cpp5-dev libjsoncpp-dev alien uuid-dev libxml2-dev cmake pkg-config expect
3636

3737

3838
# Uncomment the following lines for setup iCls
@@ -46,27 +46,27 @@ RUN apt-get update && apt-get install -y build-essential ocaml automake autoconf
4646
# systemctl enable jhi
4747

4848
RUN mkdir /root/sgx && \
49-
wget -O /root/sgx/sgx_linux_x64_psw_2.1.102.43402.bin https://download.01.org/intel-sgx/linux-2.1.2/ubuntu64-desktop/sgx_linux_x64_psw_2.1.102.43402.bin && \
50-
wget -O /root/sgx/sgx_linux_x64_sdk_2.1.102.43402.bin https://download.01.org/intel-sgx/linux-2.1.2/ubuntu64-desktop/sgx_linux_x64_sdk_2.1.102.43402.bin && \
49+
wget -O /root/sgx/psw.bin https://download.01.org/intel-sgx/linux-2.1.3/ubuntu64-desktop/sgx_linux_x64_psw_2.1.103.44322.bin && \
50+
wget -O /root/sgx/sdk.bin https://download.01.org/intel-sgx/linux-2.1.3/ubuntu64-desktop/sgx_linux_x64_sdk_2.1.103.44322.bin && \
5151
cd /root/sgx && \
52-
chmod +x /root/sgx/sgx_linux_x64_psw_2.1.102.43402.bin && \
53-
/root/sgx/sgx_linux_x64_psw_2.1.102.43402.bin && \
54-
chmod +x /root/sgx/sgx_linux_x64_sdk_2.1.102.43402.bin && \
55-
echo -e 'no\n/opt' | /root/sgx/sgx_linux_x64_sdk_2.1.102.43402.bin && \
52+
chmod +x /root/sgx/psw.bin && \
53+
/root/sgx/psw.bin && \
54+
chmod +x /root/sgx/sdk.bin && \
55+
echo -e 'no\n/opt' | /root/sgx/sdk.bin && \
5656
echo 'source /opt/sgxsdk/environment' >> /root/.bashrc
5757

5858
ADD patch /root/
5959

60-
RUN wget -O /root/sgx_2.1.2.tar.gz https://github.com/intel/linux-sgx/archive/sgx_2.1.2.tar.gz && \
61-
cd /root && tar xzf sgx_2.1.2.tar.gz && \
62-
cd /root/linux-sgx-sgx_2.1.2 && git apply ../patch && \
63-
/root/linux-sgx-sgx_2.1.2/download_prebuilt.sh && \
64-
cd /root/linux-sgx-sgx_2.1.2 && make -j && \
65-
cp /root/linux-sgx-sgx_2.1.2/build/linux/libsgx_tstdc.a /opt/sgxsdk/lib64/libsgx_tstdc.a
60+
RUN wget -O /root/src.tar.gz https://github.com/intel/linux-sgx/archive/sgx_2.1.3.tar.gz && \
61+
cd /root && tar xzf src.tar.gz && \
62+
cd /root/linux-sgx-sgx_2.1.3 && git apply ../patch && \
63+
/root/linux-sgx-sgx_2.1.3/download_prebuilt.sh && \
64+
cd /root/linux-sgx-sgx_2.1.3 && make -j && \
65+
cp /root/linux-sgx-sgx_2.1.3/build/linux/libsgx_tstdc.a /opt/sgxsdk/lib64/libsgx_tstdc.a
6666

6767
RUN wget 'https://static.rust-lang.org/rustup/dist/x86_64-unknown-linux-gnu/rustup-init' -O /root/rustup-init && \
6868
chmod +x /root/rustup-init && \
69-
echo '1' | /root/rustup-init --default-toolchain stable-2018-03-01 && \
69+
echo '1' | /root/rustup-init --default-toolchain stable-2018-05-10 && \
7070
echo 'source /root/.cargo/env' >> /root/.bashrc && \
7171
/root/.cargo/bin/rustup component add rust-src && \
7272
/root/.cargo/bin/cargo install xargo && \

documents/nbsp.pdf

5.89 MB
Binary file not shown.

libunwind/Cargo.toml

-15
This file was deleted.

mesalock-rt/libsgx_uae_service.so

100755100644
File mode changed.

mesalock-rt/libsgx_urts.so

100755100644
File mode changed.

0 commit comments

Comments
 (0)