opensgx icon indicating copy to clipboard operation
opensgx copied to clipboard

Is there a way to invoke code in an enclave programmatically?

Open ssavvides opened this issue 8 years ago • 5 comments

Is there a way to invoke code in an enclave programmatically, say through a c function, and get the result back?

ssavvides avatar Jun 21 '16 20:06 ssavvides

There is already a in-enclave libc (musl libc) you can directly use. If the function contains syscalls which is not supported inside the enclave, you may leverage trampoline mechanism to do so.

johnmwshih avatar Jun 21 '16 21:06 johnmwshih

We don't have that kind of offloading/API model yet.

Taesoo

On 06/21/16 at 01:31pm, Savvas Savvides wrote:

Is there a way to invoke code in an enclave programmatically, say through a c function and get the result back?


You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/sslab-gatech/opensgx/issues/42

tsgates avatar Jun 22 '16 03:06 tsgates

Tor example contains an RPC-like interface. But it's different from Windows SGX SDK interface in that it actually is an RPC to an existing enclave.

Dongsu Han Assistant Professor, Department of Electrical Engineering Korea Advanced Institute of Science and Technology 291 Daehak-ro, Yuseong-gu, Daejeon 305-701, Korea Office: Room 814, IT Convergence Building (N1) Tel: +82-42-350-7431 Email: [email protected]

On Wed, Jun 22, 2016 at 5:31 AM, Savvas Savvides [email protected] wrote:

Is there a way to invoke code in an enclave programmatically, say through a c function and get the result back?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/sslab-gatech/opensgx/issues/42, or mute the thread https://github.com/notifications/unsubscribe/AByS_2gqnDvQ5EjhxTRxCWTCc1FUqtHQks5qOEoQgaJpZM4I7JDV .

dongsuh avatar Jun 22 '16 05:06 dongsuh

Could you point me to that example please?

ssavvides avatar Jun 22 '16 13:06 ssavvides

In opensgx/Tor directory, there is a Tor program that communicates with an enclave. For example, in Tor/tor-0.2.5.10/src/tools/tor-gencert.c, it request an enclave to create a RSA key pairs for Tor nodes. It communicates with the enclave code located in opensgx/user/test/tor/sgx-tor.c file. In this case, we use pipe for the communication between an enclave and application. After establishing pipe with pipe_init() and pipe_open() (in sgx-tor.c), data is communicated with read() and write() libc functions with the pipe port. You can refer the source code in these files. For the general libc function, as Mingwei mentioned, we leverage functions that are used in Tor to the trampoline. (See user/sgx-trampoline.c and the source code of function in musl-libc (libsgx/musl-libc). Checking the implementation of malloc() in musl-libc is a good example to follow how we implement the trampoline interface.

Thanks, Seongmin

2016-06-22 22:51 GMT+09:00 Savvas Savvides [email protected]:

Reopened #42 https://github.com/sslab-gatech/opensgx/issues/42.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/sslab-gatech/opensgx/issues/42#event-700508339, or mute the thread https://github.com/notifications/unsubscribe/AIPbTjmZR4MNgPMrTUMqomvPN206ddgjks5qOT3lgaJpZM4I7JDV .

inasmkim avatar Jun 22 '16 22:06 inasmkim