Bruno Egremy
Bruno Egremy

Reputation: 11

SGX developement environment

I need to test run the following code SGXROP for my Bachelor's project.

To achieve this, I want to have a development environment for SGX without the required hardware (both my computers have SGX compatible CPUs but I would prefer to have an environment that doesn't rely on it, so that I could share my work with my professors easily without having them to buy a CPU) and I need to be able to have such an environment on Windows 10 and Linux Manjaro (based on Arch-Linux). So I thought I could use Intel's SDK for Linux on an Ubuntu-20 VM which I could use and move on both my computers. I tried to build the SDK by myself following the above-mentioned guide and to use the Ubuntu 20 SDK installer. Both result in the following error when making the SampleEnclave application :

/opt/intel/sgxsdk/SampleCode/SampleEnclave$ sudo make SGX_MODE=SIM
make[1]: Entering directory '/opt/intel/sgxsdk/SampleCode/SampleEnclave'
GEN  =>  App/Enclave_u.h
CC   <=  App/Enclave_u.c
CXX  <=  App/App.cpp
CXX  <=  App/Edger8rSyntax/Types.cpp
CXX  <=  App/Edger8rSyntax/Pointers.cpp
CXX  <=  App/Edger8rSyntax/Arrays.cpp
CXX  <=  App/Edger8rSyntax/Functions.cpp
CXX  <=  App/TrustedLibrary/Thread.cpp
CXX  <=  App/TrustedLibrary/Libcxx.cpp
CXX  <=  App/TrustedLibrary/Libc.cpp
/usr/local/bin/ld: warning: libsgx_uae_service_sim.so, needed by /opt/intel/sgxsdk/lib64/libsgx_urts_sim.so, not found (try using -rpath or -rpath-link)
/usr/local/bin/ld: /opt/intel/sgxsdk/lib64/libsgx_urts_sim.so: undefined reference to `get_launch_token'
collect2: error: ld returned 1 exit status
make[1]: *** [Makefile:235: app] Error 1
make[1]: Leaving directory '/opt/intel/sgxsdk/SampleCode/SampleEnclave'
make: *** [Makefile:180: all] Error 2

So I have two questions.

  1. In my use case, have I chosen the best option by opting for an Ubuntu VM and trying to use de SGX SDK in Simulation mode (is it sufficient?)?
  2. If it is a good choice, what is my mistake in my attempt to set up a development environment and run the SampleEnclave application?

Thank you to everyone for taking the time to read my questions!

Upvotes: 1

Views: 538

Answers (1)

mkayaalp
mkayaalp

Reputation: 2716

Yes, SGX Simulation Mode allows you to simulate the SGX instructions without an SGX processor:

The simulation mode works in the same way as the debug mode except the fact that true hardware is not exercised, instead the Intel® SGX instructions are simulated in software.

The error is probably due to not setting the correct shell variables. Run:

source /opt/intel/sgxsdk/environment

Upvotes: 3

Related Questions