This tutorial demonstrates how to pass data between an application and a secure Intel® Software Guard Extensions (Intel® SGX) enclave with directional enclave pointers. The user is expected to know how to set up an Intel SGX enclave and application in Microsoft Visual Studio*. Prior Intel SGX knowledge is not required, but the Intel SGX user guide may be helpful. Familiarity with C/C++ is assumed.
My setup:
- HP Envy* x360 - Windows* 10 x64
- Intel® Core™ i7-6500U
- Microsoft Visual Studio Professional 2012
- Intel® Software Guard Extensions SDK/PSW V1.1.30214.80
Enclave Code:
The enclave functions will be declared based on the following EDL file:
|
enclaveInFunction()
This function demonstrates the use of an 'in' enclave byusing external/non-enclave variable to set an internal/enclave value. Data is sent from the application into the enclave.
enclaveOutFunction()
This function demonstrates the use of an 'out' enclave by changing the value of an externally provided input parameter. Data is sent from the enclave to the application
enclaveInOutFunction()
This function demonstrates the use of both an 'in' and 'out' enclave by swapping the values of the input string and the internal enclave string. Data is exchanged between the application and enclave.
|
Create an Application:
Remember, SGX enclave code has no console output. In fact, output commands and libraries such as stdio cannot be used in a VS SGX enclave project. To test the enclave function, we will create a console application that calls the enclave functions.
|
Final output should be: