==================================
You will find in its template:
SGX EDL C
generated files to your Rust SGX projectsbuildenv.mk
that contains compilation rules when building enclave. No need to specify anymore where this file is located.build.rs
already configured to build the app/host part properly.nightly-2020-10-25
in this case)Cargo/Xargo.toml
files to set up your project easily. All the dependencies you might need has been added.You can find those files in this template:
|-- app/ | |-- src/ | |-- main.rs | |-- Cargo.toml | |-- Makefile | |-- build.rs | +-- rust-toolchain |-- enclave/ | |-- src/ | |-- lib.rs | |-- Cargo.toml | |-- Enclave.config.xml | |-- Enclave.edl | |-- Enclave.lds | |-- Makefile | |-- Xargo.toml | +-- rust-toolchain |-- Makefile +-- buildenv.mk
You need to follow a few steps to use this template properly:
.rs
files to the src/
folders (lib.rs
/ your enclave source code goes in enclave/src
, your host/app source code goes in app/src
), or modify the .rs
files already included with the projectEnclave.edl
file, or modify the one joined in the project.Cargo.toml (or/and Xargo.toml if you want to use Xargo)
files depending on of your needs (adding/removing dependencies).Cargo.toml
file (enclave part), you will need to reflect this change on the enclave Makefile
, more specifically on the ENCLAVE_CARGO_LIB
variable, and on the lib.rs
file.Makefile
, and change the variable APP_U
.Once you downloaded the Rust SGX SDK, you have multiple ways to start the building process:
CUSTOM_EDL_PATH=~/teaenclave/edl CUSTOM_COMMON_PATH=~/teaenclave/common make
(replace ~/teaenclave
by the actual SDK location)export CUSTOM_EDL_PATH=~/teaenclave/edl
), and specify the variables before calling make. It is advised to add this command on your .bashrc
file (if you use bash), or your favorite shell configuration file.SGX_MODE=SW
before make, or by setting the SGX_MODE variable environment to SW.XARGO_SGX=1
before make, or by setting the XARGO_SGX variable environment to 1. You will also need to specify Xargo library path with XARGO_PATH.