Intel® Software Guard Extensions (Intel® SGX)
Discussion board focused on hardware-based isolation and memory encryption to provide extended code protection in solutions.

Problem using Classes inside enclave

tz71
Beginner
1,006 Views

I want to write a class inside enclave. I couldn't find any sample code about it. Is there any special syntax for defining Class functions, Constructors and Destructors in edl files? I tried to define them as trusted using the same syntax as regular functions but I'm getting "Invalid token" error. Can someone give me an example of using classes inside a enclave?

Thanks,

0 Kudos
1 Solution
Mark_S_Intel2
Employee
1,007 Views

While you may use C++ classes inside an enclave, EDL will not allow you to define trusted functions as class methods.  The ECall Bridge functions (functions which the Edger8r generated code calls for you  when you enter the enclave) must be native C and will subsequently call C functions that you must implement.  The C function that you implement may subsequently make a call to a class method within a class that you have instantiated within the enclave.

EDL also does not support passing class objects across enclave boundaries.

View solution in original post

0 Kudos
1 Reply
Mark_S_Intel2
Employee
1,008 Views

While you may use C++ classes inside an enclave, EDL will not allow you to define trusted functions as class methods.  The ECall Bridge functions (functions which the Edger8r generated code calls for you  when you enter the enclave) must be native C and will subsequently call C functions that you must implement.  The C function that you implement may subsequently make a call to a class method within a class that you have instantiated within the enclave.

EDL also does not support passing class objects across enclave boundaries.

0 Kudos
Reply