Credit must go to https://github.com/apache/incubator-teaclave-sgx-sdk from which this repo was forked. It is based off the Rust Intel SGX SDK.
This installation details the local installation, setup and running of the enclave part of Proof of Concept: TrustedHealth. There are two parts to the POC as a whole and you can find the second part, a nodejs express server and web app with installation insutrctions here - https://github.com/Astewart1510/WebApp_POC.
This setup was done on a Macbook Pro 2015. For Windows, the instructions should be similar and the issues with the enclave will be solved the same, however please see windows documentation for VS Code and Docker setup and terminal syntax. To run this enclave I would suggest using VS Code and Docker. To run out of a docker container please make sure you have the latest Docker installed on your laptop. For instructions please visit the docker homepage - https://docs.docker.com/docker-for-mac/install/. Once docker is installed and VS code is open with the docker extension installed and enabled, please follow the instructions below.
- Clone or download this repo.
- Go to https://github.com/apache/incubator-teaclave-sgx-sdk#use-simulation-mode-for-non-sgx-enabled-machine-includes-macos and clone this repo to.
- Follow the installation steps provided by the above link in the incubator-teaclave-sgx-sdk repo OR to summarise, after you have cloned and downloaded the entire incubator-teaclave-sgx-sdk repo your actions should be as follows:
- Navigate to the samplecode folder (eg.
cd downloads/incubator-teaclave-sgx-sdk-master/samplecode/
) and copy the POC_Enclave repo into the samplecode folder. - Download the sgx docker image -
docker pull baiduxlab/sgx-rust
- Run the docker image with the incubator-teaclave-sgx-sdk-master repo -
docker run -v /your/path/to/rust-sgx:/root/sgx -ti baiduxlab/sgx-rust
- Open visual studio code and you should see a running docker container under the docker tab. Right click this docker container and select "Attach Visual Studio Code". See Screenshot.
- Another VS window should open and right click the POC_Enclave-master file to open it in an Integrated Terminal. See screenshot.
- The setup is complete.
- Navigate to the samplecode folder (eg.
- Now to install the dependencies run the following command in the terminal window above (root@487c758960cf:~/sgx/samplecode/POC_Enclave-master# ) -
SGX_MODE=SW make
. This initiates the enclave to run in simulation mode for demonstration purposes. - This part will take some time depending on speed of internet and processing power of laptop. I ran it off a 16GM RAM Macbook Pro 2015 wih a 100Mb/s line and it took 10 minutes.
- The latest Intel-SGX-Rust-SDK version is geared to only run on Rust nightly-10-25 and not on the latest nightly-06-27. Therefore, two failures will arise and following fixes need to be done manually. I will outline the process below, the process is the same both.
- First error:
error[E0658]: use of unstable library feature 'unsafe_cell_get_mut'
- Hover over this line and hold Command + click to open the code -
- Once the code is open hover over the bredcrmb trail at the top of the screen and select the lib.rs file. See screenshot.
- Copy or type the text from the terminal and paste in the lib.rs file. As shown in screenshots.
- Save the lib.rs file and run
SGX_MODE=SW make
in the terminal again.
- Second error:
error[E0658]: use of unstable library feature 'bool_to_option'
- The build process should complete. This process will take a while.
- Once complete run this command in terminal -
cd bin
- Then to run the app -
./app
- The app should run and initiate a server on our local machine at the address
http://localhost:9000
running off the rocket framework. Please make sure that it is running off port 9000 and not 9001. See screenshot. - Welldone! The enclave should be running and listening on port 9000 for the Web App.