Credit to https://github.com/apache/incubator-teaclave-sgx-sdk, without which this project would not be possible.
This proof of concept application runs on Intel SGX using the Rust SGX SDK.
This file serves as a guide for setting up the application on a local machine and running the project in simulation mode.
- Docker
- Rust SGX SDK
- Compatible machine: The code was developed on a 2014 Macbook Pro
- IDE: The code was developed with CLION, but VSCode also works
The setup will cover the steps to setup the application on a MacOS machine that does not natively support Intel SGX. The application will run a simulated version of Intel SGX using a docker container. Note that the initial setup may take some time depending on your computer and internet connection.
- The first step is to install the Rust SGX SDK specifically for simulation mode
- Pull the docker container:
$ docker pull baiduxlab/sgx-rust
- Start a docker with the Rust SGX SDK
$ docker run -v /your/path/to/rust-sgx:/root/sgx -ti baiduxlab/sgx-rust
- Remember to change
/your/path/to
to the path where you downloaded the docker container
- Remember to change
- Validate that the install is working:
-
Navigate to
~/sgx/samplecode/helloworld
- set the
SGX_MODE
toSW
in Makefile - Replace
SGX_MODE ?= HW
withSGX_MODE ?= SW
- OR run
export SGX_MODE=SW
in your terminal
- set the
-
Test if the sample code is working:
root@docker:~/sgx/samplecode/helloworld# make
(If you have issues trymake SGX_MODE=SW
)root@docker:~/sgx/samplecode/helloworld# cd bin
root@docker:~/sgx/samplecode/helloworld/bin# ./app
- Consult the Rust SGX SDK page if any errors occur, they have detailed setup instructions.
- Once you have verified that the Rust SGX SDK is working:
- Navigate to the samplecode folder in the Rust SGX SDK: e.g.
cd /your/path/to/rust-sgx/samplecode/
- Clone this repository into the samplecode folder
- Download the data for the application:
- Download the compressed file containing all the data from Google Drive
- Unzip the compressed file and extract all the json files to
/your/path/to/rust-sgx/samplecode/CCR-SGX/data/
- Running the POC Application
-
Remember to start the docker container, consult Step 1.
-
Navigate to the correct folder:
root@docker:~# cd sgx/samplecode/CCR-SGX
-
Run
export SGX_MODE=SW
in your terminalroot@docker:~/sgx/samplecode/CCR-SGX# make
root@docker:~/sgx/samplecode/CCR-SGX# cd bin
root@docker:~/sgx/samplecode/CCR-SGX/bin# ./app