Summary
Implement the function in a static library, without dependencies, and link the static library to the enclave and the untrusted application.
Description
Unable to determine how to build an application with a function that can be called from an enclave or from an untrusted application without duplicating the function code.
Resolution
- Implement the function in a static library without dependencies
- Link the static library to the enclave and to the untrusted application
- Call the function from the enclave or the untrusted application depending on the Intel® Software Guard Extensions (Intel® SGX) capabilities of the platform
Additional information
Read more about linking with libraries in the section Linking Enclave with Libraries in the SGX Developer Reference for your OS:
- The latest SGX Developer Reference for Linux is in Intel SGX Linux Latest Docs.
- The Intel SGX Developer Reference for Windows is distributed with the Intel® Software Guard Extensions (Intel® SGX) SDK for Windows installation package.