Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 6447161

Browse files
committedOct 5, 2019
Add SGX
1 parent 3f73764 commit 6447161

File tree

16 files changed

+291
-33
lines changed

16 files changed

+291
-33
lines changed
 

‎.drone.yml

+101
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
kind: pipeline
2+
name: rustcrypto-traits-sgx-xargo-1604-release
3+
4+
steps:
5+
- name: release-compile
6+
image: baiduxlab/sgx-rust:1604-1.0.9
7+
commands:
8+
- . /opt/sgxsdk/environment
9+
- . /root/.cargo/env
10+
- RUST_TARGET_PATH=`pwd` xargo build --target x86_64-unknown-linux-sgx --release
11+
12+
---
13+
14+
kind: pipeline
15+
name: rustcrypto-traits-sgx-xargo-1604-debug
16+
17+
steps:
18+
- name: debug-compile
19+
image: baiduxlab/sgx-rust:1604-1.0.9
20+
commands:
21+
- . /opt/sgxsdk/environment
22+
- . /root/.cargo/env
23+
- RUST_TARGET_PATH=`pwd` xargo build --target x86_64-unknown-linux-sgx
24+
25+
---
26+
27+
kind: pipeline
28+
name: rustcrypto-traits-sgx-xargo-1804-release
29+
30+
steps:
31+
- name: release-compile
32+
image: baiduxlab/sgx-rust:1804-1.0.9
33+
commands:
34+
- . /opt/sgxsdk/environment
35+
- . /root/.cargo/env
36+
- RUST_TARGET_PATH=`pwd` xargo build --target x86_64-unknown-linux-sgx --release
37+
38+
---
39+
40+
kind: pipeline
41+
name: rustcrypto-traits-sgx-xargo-1804-debug
42+
43+
steps:
44+
- name: debug-compile
45+
image: baiduxlab/sgx-rust:1804-1.0.9
46+
commands:
47+
- . /opt/sgxsdk/environment
48+
- . /root/.cargo/env
49+
- RUST_TARGET_PATH=`pwd` xargo build --target x86_64-unknown-linux-sgx
50+
51+
---
52+
53+
kind: pipeline
54+
name: rustcrypto-traits-sgx-1604-release
55+
56+
steps:
57+
- name: release-compile
58+
image: baiduxlab/sgx-rust:1604-1.0.9
59+
commands:
60+
- . /opt/sgxsdk/environment
61+
- . /root/.cargo/env
62+
- cargo build --release
63+
64+
---
65+
66+
kind: pipeline
67+
name: rustcrypto-traits-sgx-1604-hw-debug
68+
69+
steps:
70+
- name: debug-compile
71+
image: baiduxlab/sgx-rust:1604-1.0.9
72+
commands:
73+
- . /opt/sgxsdk/environment
74+
- . /root/.cargo/env
75+
- cargo build
76+
77+
---
78+
79+
kind: pipeline
80+
name: rustcrypto-traits-sgx-1804-release
81+
82+
steps:
83+
- name: release-compile
84+
image: baiduxlab/sgx-rust:1804-1.0.9
85+
commands:
86+
- . /opt/sgxsdk/environment
87+
- . /root/.cargo/env
88+
- cargo build --release
89+
90+
---
91+
92+
kind: pipeline
93+
name: rustcrypto-traits-sgx-1804-debug
94+
95+
steps:
96+
- name: debug-compile
97+
image: baiduxlab/sgx-rust:1804-1.0.9
98+
commands:
99+
- . /opt/sgxsdk/environment
100+
- . /root/.cargo/env
101+
- cargo build

‎.github/pull.yml

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
version: "1"
2+
rules:
3+
- base: master
4+
upstream: RustCrypto:master
5+
mergeMethod: none

‎Xargo.toml

+90
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
[dependencies]
2+
alloc = {}
3+
4+
[dependencies.sgx_types]
5+
git = "https://github.com/baidu/rust-sgx-sdk.git"
6+
stage = 1
7+
8+
[dependencies.sgx_demangle]
9+
git = "https://github.com/baidu/rust-sgx-sdk.git"
10+
stage = 1
11+
12+
[dependencies.panic_abort]
13+
git = "https://github.com/baidu/rust-sgx-sdk.git"
14+
stage = 1
15+
16+
[dependencies.sgx_libc]
17+
git = "https://github.com/baidu/rust-sgx-sdk.git"
18+
stage = 2
19+
20+
[dependencies.sgx_tkey_exchange]
21+
git = "https://github.com/baidu/rust-sgx-sdk.git"
22+
stage = 2
23+
24+
[dependencies.sgx_tservice]
25+
git = "https://github.com/baidu/rust-sgx-sdk.git"
26+
stage = 2
27+
28+
[dependencies.sgx_tse]
29+
git = "https://github.com/baidu/rust-sgx-sdk.git"
30+
stage = 2
31+
32+
[dependencies.sgx_tcrypto]
33+
git = "https://github.com/baidu/rust-sgx-sdk.git"
34+
stage = 2
35+
36+
[dependencies.sgx_trts]
37+
git = "https://github.com/baidu/rust-sgx-sdk.git"
38+
stage = 3
39+
40+
[dependencies.sgx_backtrace_sys]
41+
git = "https://github.com/baidu/rust-sgx-sdk.git"
42+
stage = 3
43+
44+
[dependencies.sgx_unwind]
45+
git = "https://github.com/baidu/rust-sgx-sdk.git"
46+
stage = 4
47+
48+
[dependencies.sgx_tdh]
49+
git = "https://github.com/baidu/rust-sgx-sdk.git"
50+
stage = 4
51+
52+
[dependencies.sgx_tseal]
53+
git = "https://github.com/baidu/rust-sgx-sdk.git"
54+
stage = 4
55+
56+
[dependencies.sgx_tprotected_fs]
57+
git = "https://github.com/baidu/rust-sgx-sdk.git"
58+
stage = 4
59+
60+
[dependencies.sgx_alloc]
61+
git = "https://github.com/baidu/rust-sgx-sdk.git"
62+
stage = 4
63+
64+
[dependencies.panic_unwind]
65+
git = "https://github.com/baidu/rust-sgx-sdk.git"
66+
stage = 5
67+
68+
[dependencies.std]
69+
git = "https://github.com/baidu/rust-sgx-sdk.git"
70+
stage = 6
71+
72+
[dependencies.sgx_rand]
73+
git = "https://github.com/baidu/rust-sgx-sdk.git"
74+
stage = 7
75+
76+
[dependencies.sgx_serialize]
77+
git = "https://github.com/baidu/rust-sgx-sdk.git"
78+
stage = 7
79+
80+
[dependencies.sgx_tunittest]
81+
git = "https://github.com/baidu/rust-sgx-sdk.git"
82+
stage = 7
83+
84+
[dependencies.sgx_backtrace]
85+
git = "https://github.com/baidu/rust-sgx-sdk.git"
86+
stage = 8
87+
88+
[dependencies.sgx_cov]
89+
git = "https://github.com/baidu/rust-sgx-sdk.git"
90+
stage = 8

‎block-cipher-trait/Cargo.toml

+4-2
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,13 @@ categories = ["cryptography", "no-std"]
1111

1212
[dependencies]
1313
generic-array = "0.12"
14-
blobby = { version = "0.1", optional = true }
14+
blobby = { git = "https://github.com/mesalock-linux/rustcrypto-utils-sgx", optional = true }
15+
sgx_tstd = { rev = "v1.0.9", git = "https://github.com/baidu/rust-sgx-sdk.git", optional = true }
1516

1617
[features]
17-
std = []
18+
std = ["mesalock_sgx"]
1819
dev = ["blobby"]
20+
mesalock_sgx = ["sgx_tstd"]
1921

2022
[badges]
2123
travis-ci = { repository = "RustCrypto/traits" }

‎block-cipher-trait/src/dev.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
#[macro_export]
22
macro_rules! new_test {
33
($name:ident, $test_name:expr, $cipher:ty) => {
4-
#[test]
5-
fn $name() {
4+
//#[test]
5+
pub fn $name() {
66
use block_cipher_trait::blobby::Blob3Iterator;
77
use block_cipher_trait::generic_array::typenum::Unsigned;
88
use block_cipher_trait::generic_array::GenericArray;

‎block-cipher-trait/src/lib.rs

+7-2
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,19 @@
22
//! block ciphers.
33
#![no_std]
44
#![doc(html_logo_url = "https://raw.githubusercontent.com/RustCrypto/meta/master/logo_small.png")]
5+
#![cfg_attr(all(target_env = "sgx", target_vendor = "mesalock"), feature(rustc_private))]
56
#[cfg(feature = "dev")]
67
pub extern crate blobby;
78
pub extern crate generic_array;
8-
#[cfg(feature = "std")]
9+
10+
#[cfg(all(feature = "std", feature = "mesalock_sgx", target_env = "sgx"))]
911
extern crate std;
1012

13+
#[cfg(all(feature = "std", feature = "mesalock_sgx", not(target_env = "sgx")))]
14+
extern crate sgx_tstd as std;
15+
16+
use generic_array::{GenericArray, ArrayLength};
1117
use generic_array::typenum::Unsigned;
12-
use generic_array::{ArrayLength, GenericArray};
1318

1419
#[cfg(feature = "dev")]
1520
pub mod dev;

‎crypto-mac/Cargo.toml

+5-3
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,14 @@ categories = ["cryptography", "no-std"]
1111

1212
[dependencies]
1313
generic-array = "0.12"
14-
subtle = { version = "2", default-features = false }
15-
blobby = { version = "0.1", optional = true }
14+
subtle = { git = "https://github.com/mesalock-linux/subtle-sgx" }
15+
blobby = { git = "https://github.com/mesalock-linux/rustcrypto-utils-sgx", optional = true }
16+
sgx_tstd = { rev = "v1.0.9", git = "https://github.com/baidu/rust-sgx-sdk.git", optional = true }
1617

1718
[features]
1819
dev = ["blobby"]
19-
std = []
20+
std = ["mesalock_sgx"]
21+
mesalock_sgx = ["sgx_tstd"]
2022

2123
[badges]
2224
travis-ci = { repository = "RustCrypto/traits" }

‎crypto-mac/src/dev.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
#[macro_export]
22
macro_rules! new_test {
33
($name:ident, $test_name:expr, $mac:ty) => {
4-
#[test]
5-
fn $name() {
4+
//#[test]
5+
pub fn $name() {
66
use crypto_mac::blobby::Blob3Iterator;
77
use crypto_mac::Mac;
88

‎crypto-mac/src/lib.rs

+13-2
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,19 @@
11
//! This crate provides trait for Message Authentication Code (MAC) algorithms.
22
#![no_std]
33
#![doc(html_logo_url = "https://raw.githubusercontent.com/RustCrypto/meta/master/logo_small.png")]
4+
#![cfg_attr(all(target_env = "sgx", target_vendor = "mesalock"), feature(rustc_private))]
45
pub extern crate generic_array;
56
extern crate subtle;
67

8+
#[cfg(all(feature = "std", feature = "mesalock_sgx", target_env = "sgx"))]
9+
extern crate std;
10+
#[cfg(all(feature = "std", feature = "mesalock_sgx", not(target_env = "sgx")))]
11+
extern crate sgx_tstd as std;
12+
713
#[cfg(feature = "dev")]
814
pub extern crate blobby;
9-
#[cfg(feature = "std")]
10-
extern crate std;
15+
//#[cfg(feature = "std")]
16+
//extern crate std;
1117

1218
use generic_array::typenum::Unsigned;
1319
use generic_array::{ArrayLength, GenericArray};
@@ -92,6 +98,11 @@ where
9298
pub fn code(self) -> GenericArray<u8, N> {
9399
self.code
94100
}
101+
102+
/// Added by @dingelish, to provide backward compatibility
103+
pub fn code_ref(&self) -> &GenericArray<u8, N> {
104+
&self.code
105+
}
95106
}
96107

97108
impl<N> ConstantTimeEq for MacResult<N>

‎digest/Cargo.toml

+5-3
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,16 @@ categories = ["cryptography", "no-std"]
1111

1212
[dependencies]
1313
generic-array = "0.12"
14-
blobby = { version = "0.1", optional = true }
14+
blobby = { git = "https://github.com/mesalock-linux/rustcrypto-utils-sgx", optional = true }
15+
sgx_tstd = { rev = "v1.0.9", git = "https://github.com/baidu/rust-sgx-sdk.git", optional = true }
1516

1617
[features]
17-
std = []
18+
std = ["mesalock_sgx"]
1819
dev = ["blobby"]
20+
mesalock_sgx = ["sgx_tstd"]
1921

2022
[badges]
2123
travis-ci = { repository = "RustCrypto/traits" }
2224

2325
[package.metadata.docs.rs]
24-
features = ["std"]
26+
features = ["std"]

‎digest/src/dev.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ use core::fmt::Debug;
44
#[macro_export]
55
macro_rules! new_test {
66
($name:ident, $test_name:expr, $hasher:ty, $test_func:ident) => {
7-
#[test]
8-
fn $name() {
7+
//#[test]
8+
pub fn $name() {
99
use digest::blobby::Blob2Iterator;
1010
let data = include_bytes!(concat!("data/", $test_name, ".blb"));
1111

‎digest/src/lib.rs

+5-3
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,12 @@
1414
//! The `Digest` trait is the most commonly used trait.
1515
#![no_std]
1616
#![doc(html_logo_url = "https://raw.githubusercontent.com/RustCrypto/meta/master/logo_small.png")]
17+
#![cfg_attr(all(target_env = "sgx", target_vendor = "mesalock"), feature(rustc_private))]
1718
pub extern crate generic_array;
18-
#[cfg(feature = "std")]
19-
#[macro_use]
20-
extern crate std;
19+
#[cfg(all(feature = "std", feature = "mesalock_sgx", target_env = "sgx"))]
20+
#[macro_use] extern crate std;
21+
#[cfg(all(feature = "std", feature = "mesalock_sgx", not(target_env = "sgx")))]
22+
#[macro_use] extern crate sgx_tstd as std;
2123
#[cfg(feature = "dev")]
2224
pub extern crate blobby;
2325
use generic_array::{ArrayLength, GenericArray};

‎stream-cipher/Cargo.toml

+4-2
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,13 @@ categories = ["cryptography", "no-std"]
1111

1212
[dependencies]
1313
generic-array = "0.12"
14-
blobby = { version = "0.1", optional = true }
14+
blobby = { git = "https://github.com/mesalock-linux/rustcrypto-utils-sgx", optional = true }
15+
sgx_tstd = { rev = "v1.0.9", git = "https://github.com/baidu/rust-sgx-sdk.git", optional = true }
1516

1617
[features]
17-
std = []
18+
std = ["mesalock_sgx"]
1819
dev = ["blobby"]
20+
mesalock_sgx = ["sgx_tstd"]
1921

2022
[badges]
2123
travis-ci = { repository = "RustCrypto/traits" }

0 commit comments

Comments
 (0)
Please sign in to comment.