Intel® Software Guard Extensions (Intel® SGX)
Use hardware-based isolation and memory encryption to provide more code protection in your solutions.

SGX with Position Dependent Static Libraries

csoder
Beginner
405 Views

Is it possible to create an SGX application that references a static library, compiled as position-dependent code? 

I have attempted to port a test application to an SGX application using a 3rd party porting tool, and have found I'm only able to do this successfully when all of the involved libraries are compiled using the -fPIC tag.

For one of the libraries I would like my enclave functions to reference, I only have access to the .a files, so recompiling the library as PIC is not an option. Looking through SGX documentation, I have been unable to narrow down if this is a limitation of SGX, or if its perhaps just the manner in which I'm trying to port the application.  

I found this thread, where someone appears to have the same issue as me with a different library, but the link to the solution is broken: https://community.intel.com/t5/Intel-Software-Guard-Extensions/Build-enclave-using-libgmp/m-p/115164... 

 

Any guidance?

 

Labels (1)
0 Kudos
1 Solution
Sahira_Intel
Moderator
338 Views

Hi,


Porting a library means recompiling it from source where the -fPIC flag is mandatory. But since you only have access to .a files, your best option would be to use Gramine (https://github.com/gramineproject/gramine) to wrap the whole application in an enclave. This is not necessarily the same as porting a library, but it could work for your use case.


Sincerely,

Sahira R.



View solution in original post

3 Replies
Sahira_Intel
Moderator
378 Views

Hi,


Here is an example of how the GMP library was ported to SGX: https://github.com/intel/sgx-gmp to be used in an enclave


Sincerely,

Sahira




Sahira_Intel
Moderator
339 Views

Hi,


Porting a library means recompiling it from source where the -fPIC flag is mandatory. But since you only have access to .a files, your best option would be to use Gramine (https://github.com/gramineproject/gramine) to wrap the whole application in an enclave. This is not necessarily the same as porting a library, but it could work for your use case.


Sincerely,

Sahira R.



csoder
Beginner
313 Views
Reply