From 2a0f1222fcb0b26405f3d731a091121a9db293f4 Mon Sep 17 00:00:00 2001 From: Yu Ding Date: Tue, 16 Jul 2019 03:21:08 -0700 Subject: [PATCH] Port to sgx 1.1.0 --- .drone.yml | 101 ++++++++++++++++++++++++ .github/pull.yml | 5 ++ Xargo.toml | 95 ++++++++++++++++++++++ blobby/Cargo.toml | 6 +- blobby/Xargo.toml | 95 ++++++++++++++++++++++ block-buffer/Cargo.toml | 6 +- block-buffer/src/lib.rs | 2 +- block-padding/Cargo.toml | 2 +- hex-literal/hex-literal-impl/src/lib.rs | 2 +- hex-literal/src/lib.rs | 2 +- x86_64-unknown-linux-sgx.json | 31 ++++++++ 11 files changed, 337 insertions(+), 10 deletions(-) create mode 100644 .drone.yml create mode 100644 .github/pull.yml create mode 100644 Xargo.toml create mode 100644 blobby/Xargo.toml create mode 100644 x86_64-unknown-linux-sgx.json diff --git a/.drone.yml b/.drone.yml new file mode 100644 index 00000000..83512221 --- /dev/null +++ b/.drone.yml @@ -0,0 +1,101 @@ +kind: pipeline +name: utils-sgx-xargo-1604-release + +steps: +- name: release-compile + image: baiduxlab/sgx-rust:1604-1.1.0 + commands: + - . /opt/sgxsdk/environment + - . /root/.cargo/env + - RUST_TARGET_PATH=`pwd` xargo build --target x86_64-unknown-linux-sgx --release + +--- + +kind: pipeline +name: utils-sgx-xargo-1604-debug + +steps: +- name: debug-compile + image: baiduxlab/sgx-rust:1604-1.1.0 + commands: + - . /opt/sgxsdk/environment + - . /root/.cargo/env + - RUST_TARGET_PATH=`pwd` xargo build --target x86_64-unknown-linux-sgx + +--- + +kind: pipeline +name: utils-sgx-xargo-1804-release + +steps: +- name: release-compile + image: baiduxlab/sgx-rust:1804-1.1.0 + commands: + - . /opt/sgxsdk/environment + - . /root/.cargo/env + - RUST_TARGET_PATH=`pwd` xargo build --target x86_64-unknown-linux-sgx --release + +--- + +kind: pipeline +name: utils-sgx-xargo-1804-debug + +steps: +- name: debug-compile + image: baiduxlab/sgx-rust:1804-1.1.0 + commands: + - . /opt/sgxsdk/environment + - . /root/.cargo/env + - RUST_TARGET_PATH=`pwd` xargo build --target x86_64-unknown-linux-sgx + +--- + +kind: pipeline +name: utils-sgx-1604-release + +steps: +- name: release-compile + image: baiduxlab/sgx-rust:1604-1.1.0 + commands: + - . /opt/sgxsdk/environment + - . /root/.cargo/env + - cargo build --release + +--- + +kind: pipeline +name: utils-sgx-1604-hw-debug + +steps: +- name: debug-compile + image: baiduxlab/sgx-rust:1604-1.1.0 + commands: + - . /opt/sgxsdk/environment + - . /root/.cargo/env + - cargo build + +--- + +kind: pipeline +name: utils-sgx-1804-release + +steps: +- name: release-compile + image: baiduxlab/sgx-rust:1804-1.1.0 + commands: + - . /opt/sgxsdk/environment + - . /root/.cargo/env + - cargo build --release + +--- + +kind: pipeline +name: utils-sgx-1804-debug + +steps: +- name: debug-compile + image: baiduxlab/sgx-rust:1804-1.1.0 + commands: + - . /opt/sgxsdk/environment + - . /root/.cargo/env + - cargo build diff --git a/.github/pull.yml b/.github/pull.yml new file mode 100644 index 00000000..e2a10753 --- /dev/null +++ b/.github/pull.yml @@ -0,0 +1,5 @@ +version: "1" +rules: + - base: master + upstream: RustCrypto:master + mergeMethod: none diff --git a/Xargo.toml b/Xargo.toml new file mode 100644 index 00000000..ef14c968 --- /dev/null +++ b/Xargo.toml @@ -0,0 +1,95 @@ +[dependencies] +alloc = {} + +[dependencies.sgx_types] +git = "https://github.com/apache/teaclave-sgx-sdk.git" +stage = 1 + +[dependencies.sgx_alloc] +git = "https://github.com/apache/teaclave-sgx-sdk.git" +stage = 1 + +[dependencies.sgx_unwind] +git = "https://github.com/apache/teaclave-sgx-sdk.git" +stage = 1 + +[dependencies.sgx_demangle] +git = "https://github.com/apache/teaclave-sgx-sdk.git" +stage = 1 + +[dependencies.panic_abort] +git = "https://github.com/apache/teaclave-sgx-sdk.git" +stage = 1 + +[dependencies.sgx_libc] +git = "https://github.com/apache/teaclave-sgx-sdk.git" +stage = 2 + +[dependencies.sgx_tkey_exchange] +git = "https://github.com/apache/teaclave-sgx-sdk.git" +stage = 2 + +[dependencies.sgx_tservice] +git = "https://github.com/apache/teaclave-sgx-sdk.git" +stage = 2 + +[dependencies.sgx_tse] +git = "https://github.com/apache/teaclave-sgx-sdk.git" +stage = 2 + +[dependencies.sgx_tcrypto] +git = "https://github.com/apache/teaclave-sgx-sdk.git" +stage = 2 + +[dependencies.sgx_trts] +git = "https://github.com/apache/teaclave-sgx-sdk.git" +stage = 3 + +[dependencies.sgx_backtrace_sys] +git = "https://github.com/apache/teaclave-sgx-sdk.git" +stage = 3 + +[dependencies.panic_unwind] +git = "https://github.com/apache/teaclave-sgx-sdk.git" +stage = 3 + +[dependencies.sgx_tdh] +git = "https://github.com/apache/teaclave-sgx-sdk.git" +stage = 4 + +[dependencies.sgx_tseal] +git = "https://github.com/apache/teaclave-sgx-sdk.git" +stage = 4 + +[dependencies.sgx_tprotected_fs] +git = "https://github.com/apache/teaclave-sgx-sdk.git" +stage = 4 + +[dependencies.std] +git = "https://github.com/apache/teaclave-sgx-sdk.git" +features = ["backtrace", "net"] +stage = 5 + +[dependencies.sgx_no_tstd] +git = "https://github.com/apache/teaclave-sgx-sdk.git" +stage = 5 + +[dependencies.sgx_rand] +git = "https://github.com/apache/teaclave-sgx-sdk.git" +stage = 6 + +[dependencies.sgx_serialize] +git = "https://github.com/apache/teaclave-sgx-sdk.git" +stage = 6 + +[dependencies.sgx_tunittest] +git = "https://github.com/apache/teaclave-sgx-sdk.git" +stage = 6 + +[dependencies.sgx_backtrace] +git = "https://github.com/apache/teaclave-sgx-sdk.git" +stage = 7 + +[dependencies.sgx_cov] +git = "https://github.com/apache/teaclave-sgx-sdk.git" +stage = 7 diff --git a/blobby/Cargo.toml b/blobby/Cargo.toml index c0cbe41b..c12ab29b 100644 --- a/blobby/Cargo.toml +++ b/blobby/Cargo.toml @@ -9,11 +9,11 @@ repository = "https://github.com/RustCrypto/utils" categories = ["no-std"] [dependencies] -byteorder = { version = "1", default-features = false } +byteorder = { git = "https://github.com/mesalock-linux/byteorder-sgx" } [dev-dependencies] -hex = "0.3" -byteorder = { version = "1", features = ["std"] } +#hex = "0.3" +#byteorder = { version = "1", features = ["std"] } [badges] travis-ci = { repository = "RustCrypto/utils" } diff --git a/blobby/Xargo.toml b/blobby/Xargo.toml new file mode 100644 index 00000000..ef14c968 --- /dev/null +++ b/blobby/Xargo.toml @@ -0,0 +1,95 @@ +[dependencies] +alloc = {} + +[dependencies.sgx_types] +git = "https://github.com/apache/teaclave-sgx-sdk.git" +stage = 1 + +[dependencies.sgx_alloc] +git = "https://github.com/apache/teaclave-sgx-sdk.git" +stage = 1 + +[dependencies.sgx_unwind] +git = "https://github.com/apache/teaclave-sgx-sdk.git" +stage = 1 + +[dependencies.sgx_demangle] +git = "https://github.com/apache/teaclave-sgx-sdk.git" +stage = 1 + +[dependencies.panic_abort] +git = "https://github.com/apache/teaclave-sgx-sdk.git" +stage = 1 + +[dependencies.sgx_libc] +git = "https://github.com/apache/teaclave-sgx-sdk.git" +stage = 2 + +[dependencies.sgx_tkey_exchange] +git = "https://github.com/apache/teaclave-sgx-sdk.git" +stage = 2 + +[dependencies.sgx_tservice] +git = "https://github.com/apache/teaclave-sgx-sdk.git" +stage = 2 + +[dependencies.sgx_tse] +git = "https://github.com/apache/teaclave-sgx-sdk.git" +stage = 2 + +[dependencies.sgx_tcrypto] +git = "https://github.com/apache/teaclave-sgx-sdk.git" +stage = 2 + +[dependencies.sgx_trts] +git = "https://github.com/apache/teaclave-sgx-sdk.git" +stage = 3 + +[dependencies.sgx_backtrace_sys] +git = "https://github.com/apache/teaclave-sgx-sdk.git" +stage = 3 + +[dependencies.panic_unwind] +git = "https://github.com/apache/teaclave-sgx-sdk.git" +stage = 3 + +[dependencies.sgx_tdh] +git = "https://github.com/apache/teaclave-sgx-sdk.git" +stage = 4 + +[dependencies.sgx_tseal] +git = "https://github.com/apache/teaclave-sgx-sdk.git" +stage = 4 + +[dependencies.sgx_tprotected_fs] +git = "https://github.com/apache/teaclave-sgx-sdk.git" +stage = 4 + +[dependencies.std] +git = "https://github.com/apache/teaclave-sgx-sdk.git" +features = ["backtrace", "net"] +stage = 5 + +[dependencies.sgx_no_tstd] +git = "https://github.com/apache/teaclave-sgx-sdk.git" +stage = 5 + +[dependencies.sgx_rand] +git = "https://github.com/apache/teaclave-sgx-sdk.git" +stage = 6 + +[dependencies.sgx_serialize] +git = "https://github.com/apache/teaclave-sgx-sdk.git" +stage = 6 + +[dependencies.sgx_tunittest] +git = "https://github.com/apache/teaclave-sgx-sdk.git" +stage = 6 + +[dependencies.sgx_backtrace] +git = "https://github.com/apache/teaclave-sgx-sdk.git" +stage = 7 + +[dependencies.sgx_cov] +git = "https://github.com/apache/teaclave-sgx-sdk.git" +stage = 7 diff --git a/block-buffer/Cargo.toml b/block-buffer/Cargo.toml index 236d2653..92d14ebb 100644 --- a/block-buffer/Cargo.toml +++ b/block-buffer/Cargo.toml @@ -10,9 +10,9 @@ keywords = ["block", "buffer"] categories = ["cryptography", "no-std"] [dependencies] -byteorder = { version = "1.1", default-features = false } -byte-tools = "0.3" -block-padding = "0.1" +byteorder = { git = "https://github.com/mesalock-linux/byteorder-sgx" } +byte-tools = { git = "https://github.com/mesalock-linux/rustcrypto-utils-sgx" } +block-padding = { git = "https://github.com/mesalock-linux/rustcrypto-utils-sgx" } generic-array = "0.12" [badges] diff --git a/block-buffer/src/lib.rs b/block-buffer/src/lib.rs index d3b69165..a1d38c4a 100644 --- a/block-buffer/src/lib.rs +++ b/block-buffer/src/lib.rs @@ -8,7 +8,7 @@ use byteorder::{ByteOrder, BE}; use byte_tools::zero; use block_padding::{Padding, PadError}; use generic_array::{GenericArray, ArrayLength}; -use core::slice; +//use core::slice; /// Buffer for block processing of data #[derive(Clone, Default)] diff --git a/block-padding/Cargo.toml b/block-padding/Cargo.toml index 618ab7b1..07341b77 100644 --- a/block-padding/Cargo.toml +++ b/block-padding/Cargo.toml @@ -10,7 +10,7 @@ keywords = ["padding", "pkcs7", "ansix923", "iso7816"] categories = ["cryptography", "no-std"] [dependencies] -byte-tools = "0.3" +byte-tools = { git = "https://github.com/mesalock-linux/rustcrypto-utils-sgx" } [badges] travis-ci = { repository = "RustCrypto/utils" } diff --git a/hex-literal/hex-literal-impl/src/lib.rs b/hex-literal/hex-literal-impl/src/lib.rs index 009a0b5f..dfa34084 100644 --- a/hex-literal/hex-literal-impl/src/lib.rs +++ b/hex-literal/hex-literal-impl/src/lib.rs @@ -5,7 +5,7 @@ use proc_macro_hack::proc_macro_hack; fn is_hex_char(c: &char) -> bool { match *c { - '0'...'9' | 'a'...'f' | 'A'...'F' => true, + '0'..='9' | 'a'..='f' | 'A'..='F' => true, _ => false, } } diff --git a/hex-literal/src/lib.rs b/hex-literal/src/lib.rs index ed033a65..387c0301 100644 --- a/hex-literal/src/lib.rs +++ b/hex-literal/src/lib.rs @@ -25,9 +25,9 @@ //! assert_eq!(bytes, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]); //! # } //! ``` +#![no_std] #![doc(html_logo_url = "https://raw.githubusercontent.com/RustCrypto/meta/master/logo_small.png")] - use proc_macro_hack::proc_macro_hack; #[doc(hidden)] #[proc_macro_hack] diff --git a/x86_64-unknown-linux-sgx.json b/x86_64-unknown-linux-sgx.json new file mode 100644 index 00000000..10d37a74 --- /dev/null +++ b/x86_64-unknown-linux-sgx.json @@ -0,0 +1,31 @@ +{ + "arch": "x86_64", + "cpu": "x86-64", + "data-layout": "e-m:e-i64:64-f80:128-n8:16:32:64-S128", + "dynamic-linking": true, + "env": "sgx", + "exe-allocation-crate": "alloc_system", + "executables": true, + "has-elf-tls": true, + "has-rpath": true, + "linker-flavor": "gcc", + "linker-is-gnu": true, + "llvm-target": "x86_64-unknown-linux-gnu", + "max-atomic-width": 64, + "os": "linux", + "position-independent-executables": true, + "pre-link-args": { + "gcc": [ + "-Wl,--as-needed", + "-Wl,-z,noexecstack", + "-m64" + ] + }, + "relro-level": "full", + "stack-probes": true, + "target-c-int-width": "32", + "target-endian": "little", + "target-family": "unix", + "target-pointer-width": "64", + "vendor": "mesalock" +}