Skip to content

How to setup the first SGX Project

Mats edited this page Mar 29, 2020 · 12 revisions

This tutorial describes how to to setup a basic SGX project with Eclipse. This is a tutorial that combines SGX building blocks and the IDE for the first time.


We will start with an new C/C++ project.

Screenshot from 2020-02-23 15-48-57


We choose C++ Managed Build in the following assistant for using make in the building process.

Screenshot from 2020-02-23 15-49-12


At the next step we will choose Empty project and use the Linux GCC.

Screenshot from 2020-02-23 15-49-41


In the next section nothing needs to be changed. We will use Release and Debug.

Screenshot from 2020-02-23 15-49-49


After this we see the new project in eclipse. Rightclick on the project folder to open the context menu an click on Add Intel(R) SGX Nature

Screenshot from 2020-02-23 15-50-22


Now we can see a new Makefile which contains the building information, generated by Intels SGX Plugin.

Screenshot from 2020-02-23 15-50-49


Next, we will add our enclave to the project.

Screenshot from 2020-02-23 15-51-13


In the following dialog, we have to enter a name for the enclave application. Screenshot from 2020-02-23 15-51-26


After entering an enclave name, we can see the generated enclave file structure (trusted/untrusted parts). Eclipse will show you an error for an ecall function. This is caused by missing files, which will be generated by building the project. The project can be built by pressing the button with the hammer symbol in the upper left corner.

Screenshot from 2020-02-23 15-52-46


After running the build process we have to Rebuild C/C++ Index.

Screenshot from 2020-02-23 15-53-45


In order to be able to run and debug the application, the corresponding runtime configuration must be set up.

First, we will create a new Launch Configuration.

image


In the following dialog, select the launch mode run and the launch configuration type C/C++ Application.

image


Next step is to define the application which is to be started. Here we will select our sample application by clicking the Search Project button and selecting the Sample application.

image


Finally, check again that your settings match the settings on the picture below. Please note that your paths may differ from ours.

image


Finally, we will now set up the SGX debugger. If you have installed the SGX SDK in the directory as described in How to install Intel SGX SDK on Ubuntu?, you can use the path /opt/intel/sgxsdk/bin/sgx-gdb as shown in the following image.

image


Now everything is set up and you can start developing the actual SGX application.