Skip To Main Content
Support Knowledge Base

Unable to call Intel® Software Guard Extensions (Intel® SGX) Enclave Code from Untrusted Dynamic-Link Library (DLL)

Content Type: Product Information & Documentation   |   Article ID: 000059438   |   Last Reviewed: 07/23/2021

Environment

Operating System

windows1032bit, windows1064bit

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

  1. Create a DLL project in Visual Studio* as described in Walkthrough: Create and use your own Dynamic Link Library (C++)
  2. Paste code from C:\Program Files (x86)\Intel\IntelSGXSDK\src\SampleEnclave\App\App.cpp into the entry point in the DLL source file.
  3. Copy the project settings from C:\Program Files (x86)\Intel\IntelSGXSDK\src\SampleEnclave\App.
  4. 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++)
  5. 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.
  6. Compile and link the solution.
  7. Create another executable project that links the .lib files for the untrusted DLL and the enclave DLL.
  8. Paste the untrusted and signed enclave DLLs into the same directory as the executable.