sslab-gatech / opensgx

OpenSGX
Other
288 stars 80 forks source link

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

Open ssavvides opened 8 years ago

ssavvides commented 8 years ago

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

johnmwshih commented 8 years ago

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.

tsgates commented 8 years ago

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

dongsuh commented 8 years ago

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: dongsu_han@kaist.ac.kr

On Wed, Jun 22, 2016 at 5:31 AM, Savvas Savvides notifications@github.com 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 .

ssavvides commented 8 years ago

Could you point me to that example please?

inasmkim commented 8 years ago

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 notifications@github.com:

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 .