SGX Developer Guidance (for Ubuntu 18.04)


Main reference is https://blog.csdn.net/qq_35565669/article/details/99706587 and https://blog.csdn.net/u013433886/article/details/117715502. This is an English version with updated information for sgx developers.


1. Ensure that the hardware support Intel SGX. If so, enable it in BIOS.
1.1) Check CPU version through https://ark.intel.com/content/www/us/en/ark.html, and the available CPU will be marked as “YES/YES with ME”.
1.2) Compile the code using gcc. It will output “sgx available: 1” if the hardware support SGX.
1.3) Install cupid via apt and run the following command

cpuid -1 | grep -i sgx

output “SGX: Software Guard Extensions supported = true” means SGX is supported.
Prepare SGX developing environment.
2.1) Download and install required sources of SGX for Linux, including SGX driver, SGX PSW and SGX SDK through this link: sgx-ubuntu-18.04 .
在这里插入图片描述

Figure 1 Intel SGX sources list
  • libsgx-enclave-common_2.3.101.46683-1_amd64.deb→SGX PSW
  • sgx_linux_x64_driver_4d69b9c.bin→ SGX driver
  • sgx_linux_x64_sdk_2.3.101.46683.bin→SGX SDK

2.2) Install necessary tools. Open Terminal and input the following commands:
sudo apt-get install libssl-dev libcurl4-openssl-dev libprotobuf-dev
sudo apt-get install build-essential
sudo apt-get install uuid-dev libxml2-dev cmake libsystemd-dev
Then, install alien through the following command:
sudo apt-get install alien
2.3) (If FAILED, just SKIP this step temporarily) Download and install Intel Capability Licensing Service (iclsClient). Download this tool at http://registrationcenter-download.intel.com/akdlm/irc_nas/11414/iclsClient-1.45.449.12-1.x86_64.rpm. Then enter the download path and compile iclsClient:

sudo alien --scripts iclsClient-1.45.449.12-1.x86_64.rpm

and install iclsClient using the generated .deb file. (The iclsClient is required but has been removed now. I still mention this step here to remind you that, it would be necessary for more advanced development while will not influence basic development, e.g., the “hello world!” project.)
2.4) Download and install JHI service. Obtain and download the source code via https://github.com/intel/dynamic-application-loader-host-interface. Then extract the source code from .zip (or.gz). Open terminal in current folder, followed by compiling and installing JHI service using the following commands :

cmake .
make
sudo make install
sudo systemctl enable jhi

2.5) Install SGX driver
a) Modify access of .bin. Open terminal at the folder stored the .bin file, which is for sgx driver listed in Figure 1. Input the following command to upgrade the access level of .bin file:

chmod 777 sgx_linux_x64_driver_4d69b9c.bin

b) Run the .bin file using the following command:
sudo ./sgx_linux_x64_driver_4d69b9c.bin
You will find a bush file named “uninstall.sh” at /opt/intel/sgxdriver. You can double check the installation status by running:

ls /dev/isgx >/dev/null 2>1 && echo "SGX Driver installed" || echo "SGX Driver NOT installed"

If get “SGX Driver installed”, the driver is successfully installed.
2.6) Install SGX PSW
Open terminal in current folder, where stored the required sources listed in Figure 1, and install SGX PSW through the following command:

sudo dpkg -i libsgx-enclave-common_2.3.101.46683-1_amd64.deb

The generated PSW library is installed at usr/lib/x86_64-linux-gnu by default, and the AESM services and related library are installed at /opt/intel/libsgx-enclave-common by default.
2.7) Install SGX SDK
a) Upgrade the .bin file for sgx sdk using the following command:

chmod 777 sgx_linux_x64_sdk_2.3.101.46683.bin

b) Install SGX SDK by running:

sudo ./sgx_linux_x64_sdk_2.3.101.46683.bin

Throughout the installation, the installed path will be asked. You can input “no” and configure a customized route to install SGX SDK. By default, the SGX SDK will be placed at /opt/intel/sgxsdk.
3. Test the SGX——the “Hello world!” application
3.1) Enter SampleCode folder and set SGX environment:

source opt/intel/sgxsdk

Or Optionally, you can set SGX environment be a global and static path.
3.2) compile SampleCode (e.g., SampleEnclave):

cd SampleEnclave
make

If successfully compiled, it will output an executed file “app”.
3.3) Run the app file by input

./app

in the terminal. If you see the result like:
在这里插入图片描述

Figure 2 Expected output of SampleEnclave

The SGX is successfully deployed in this platform.

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值