Code Monkey home page Code Monkey logo

rust-sgx-sdk-playground's Introduction

Hello World to rust-sgx-sdk

Docker playground

All examples can be built and run in simulation mode within docker containers provided by the official repository.

To speed up daily development, the play.sh can be used to bootstrap a ready container for you, with a simple command

# this will mount ${PWD} into the /workspace directory within the container
./scripts/play.sh

Preparation

  1. Pull in the official incubator-teaclave-sgx-sdk submodule
    git submodule update --init 

Build

# as many as you want
mkdir build 
cd build
# default is SIM mode. For hardware mode, use 'cmake -DCMAKE_BUILD_TYPE=Release ..'
cmake ..
make -j

Run

# the hello-world example
make run-hello-world

Examples

The mitigration towards [email protected] is WIP

Project Description
crypto cryptographic primitives
hello-world hello-world example with app built with cargo build script
hello-world-debug hello-world example demonstrating sgx-gdb-based debugging and sgx_emmt-based memory measurement
hello-world-i-dont-like hello-world example
https-client a https client running within enclaves
massive-stdio test the maximum buffer size of arguments in ecalls/ocalls
mini-ecdh demonstrate how to do ECDH
prost-based-protobuf a demo of using protobuf implemented by the prost library
tls-server a TLS server running within enclaves

FYI

  • In the hardware mode, please employ the specific rust toolchain tagged by nightly-2019-08-01
    rustup install nightly-2019-08-01
    rustup default nightly-2019-08-01
  • For errors of pattern as follow, it's because dependencies bring std into the no_std environment. As for how to address this, check apache/incubator-teaclave-sgx-sdk#31
    error: duplicate lang item in crate `sgx_tstd`: `f32_runtime`.
    |
    = note: first defined in crate `std`.
  • When generating the trusted and untrusted bridges, projects would need to search rust-sgx-sdk/edl for extra edl files. We should keep the these edl synchronized to the version of rust-sgx-sdk in use.
  • libcompiler-rt-patch.a is to address a potential bug, so it's optional.

Git Tips

delete submodules

git submodule deinit ${path-to-submodule}
git rm --cached ${path-to-submodule}

rm -rf ${path-to-submodule}

rust-sgx-sdk-playground's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

isgasho

rust-sgx-sdk-playground's Issues

https-client failed to build

Reproduce

git clone https://github.com/sammyne/rust-sgx-sdk-playground.git
cd rust-sgx-sdk-playground
git checkout https-client

./scripts/play.sh

mkdir build 
cd build

# default is SIM mode
cmake ..
make -j

error as

[PACK] enclave
   Compiling enclave v1.0.0 (/workspace/https-client/enclave)
error: the `#[global_allocator]` in sgx_tstd conflicts with this global allocator in: sgx_tstd

error: duplicate lang item in crate `sgx_tstd`: `f32_runtime`.
  |
  = note: first defined in crate `sgx_tstd`.

error: duplicate lang item in crate `sgx_tstd`: `f64_runtime`.
  |
  = note: first defined in crate `sgx_tstd`.

error: duplicate lang item in crate `sgx_tstd`: `panic_impl`.
  |
  = note: first defined in crate `sgx_tstd`.

error: duplicate lang item in crate `sgx_tstd`: `begin_panic`.
  |
  = note: first defined in crate `sgx_tstd`.

error: duplicate lang item in crate `sgx_tstd`: `oom`.
  |
  = note: first defined in crate `sgx_tstd`.

error[E0277]: the trait bound `std::net::TcpStream: sgx_tstd::io::Read` is not satisfied
  --> src/lib.rs:60:10
   |
60 |         .connect(addr.host().unwrap_or(""), stream)
   |          ^^^^^^^ the trait `sgx_tstd::io::Read` is not implemented for `std::net::TcpStream`

error[E0277]: the trait bound `std::net::TcpStream: sgx_tstd::io::Write` is not satisfied
  --> src/lib.rs:60:10
   |
60 |         .connect(addr.host().unwrap_or(""), stream)
   |          ^^^^^^^ the trait `sgx_tstd::io::Write` is not implemented for `std::net::TcpStream`

error[E0277]: the trait bound `std::net::TcpStream: sgx_tstd::io::Read` is not satisfied
  --> src/lib.rs:59:22
   |
59 |       let mut stream = tls::Config::default()
   |  ______________________^
60 | |         .connect(addr.host().unwrap_or(""), stream)
61 | |         .unwrap();
   | |_________________^ the trait `sgx_tstd::io::Read` is not implemented for `std::net::TcpStream`
   |
   = note: required by `http_req::tls::Conn`

error[E0277]: the trait bound `std::net::TcpStream: sgx_tstd::io::Write` is not satisfied
  --> src/lib.rs:59:22
   |
59 |       let mut stream = tls::Config::default()
   |  ______________________^
60 | |         .connect(addr.host().unwrap_or(""), stream)
61 | |         .unwrap();
   | |_________________^ the trait `sgx_tstd::io::Write` is not implemented for `std::net::TcpStream`
   |
   = note: required by `http_req::tls::Conn`

error[E0277]: the trait bound `std::net::TcpStream: sgx_tstd::io::Read` is not satisfied
  --> src/lib.rs:69:10
   |
69 |         .send(&mut stream, &mut writer)
   |          ^^^^ the trait `sgx_tstd::io::Read` is not implemented for `std::net::TcpStream`
   |
   = note: required because of the requirements on the impl of `sgx_tstd::io::Write` for `http_req::tls::Conn<std::net::TcpStream>`

error[E0277]: the trait bound `std::net::TcpStream: sgx_tstd::io::Write` is not satisfied
  --> src/lib.rs:69:10
   |
69 |         .send(&mut stream, &mut writer)
   |          ^^^^ the trait `sgx_tstd::io::Write` is not implemented for `std::net::TcpStream`
   |
   = note: required because of the requirements on the impl of `sgx_tstd::io::Write` for `http_req::tls::Conn<std::net::TcpStream>`

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.