Summary
How to create a DLL that calls enclave code using Visual Studio*
Description
- Created Dynamic-Link Library (DLL) that contains untrusted code and attempts to make calls into an enclave.
- Untrusted DLL thread gets stuck when calling sgx_create_enclave().
Resolution
- Create a DLL project in Visual Studio* as described in Walkthrough: Create and use your own Dynamic Link Library (C++)
- Paste code from C:\Program Files (x86)\Intel\IntelSGXSDK\src\SampleEnclave\App\App.cpp into the entry point in the DLL source file.
- Copy the project settings from C:\Program Files (x86)\Intel\IntelSGXSDK\src\SampleEnclave\App.
- In the DLL's header file, export the enclave calls using the example in Step 4 of Walkthrough: Create and use your own Dynamic Link Library (C++)
- Follow the Intel SGX Developer Reference Guide for Windows to add the Sample Enclave project from C:\Program Files (x86)\Intel\IntelSGXSDK\src\SampleEnclave\Enclave into the Visual Studio solution.
- Compile and link the solution.
- Create another executable project that links the .lib files for the untrusted DLL and the enclave DLL.
- Paste the untrusted and signed enclave DLLs into the same directory as the executable.