#sgx #api-bindings

mc-sgx-tstdc

Rust wrappers around SGX synchronization primitives

12 releases (4 breaking)

new 0.8.0 Sep 21, 2023
0.7.2 Jul 20, 2023
0.5.0 Mar 8, 2023

#702 in Hardware support

Download history 21/week @ 2023-05-31 8/week @ 2023-06-07 14/week @ 2023-06-14 73/week @ 2023-06-21 18/week @ 2023-06-28 11/week @ 2023-07-05 60/week @ 2023-07-12 61/week @ 2023-07-19 16/week @ 2023-07-26 69/week @ 2023-08-02 74/week @ 2023-08-09 18/week @ 2023-08-16 70/week @ 2023-08-23 12/week @ 2023-08-30 33/week @ 2023-09-06 8/week @ 2023-09-13

123 downloads per month
Used in 2 crates (via mc-sgx-sync)

Apache-2.0

33KB
314 lines

MobileCoin: Rust wrappers around SGX synchronization primitives

Project ChatLicenseTargetCrates.ioDocs StatusDependency Status

Rust wrappers around SGX synchronization primitives.

The primitives exposed through this crate are low-level building blocks for higher-level constructs. Most people will want to use mc-sgx-sync to get std::sync compatible constructs.

The underlying implementation of Mutex, RwLock, and Condvar make OCALLs:

  • sgx_thread_wait_untrusted_event_ocall()
  • sgx_thread_set_multiple_untrusted_events_ocall()
  • sgx_thread_set_untrusted_event_ocall()
  • sgx_thread_setwait_untrusted_events_ocall()

These OCALLs are provided the waiting thread(s) and a return value to fill out. The OCALLs can suspend and or spuriously wake up trusted threads. The application (untrusted) inherently has control of whether the enclave thread(s) will execute. The OCALLs further increase the surface area that the application has in controlling the execution of enclave thread(s). Using these synchronization primitives, the application is now capable of stopping enclave thread(s) consistently at the synchronization points.

Dependencies

~1.3–3.5MB
~76K SLoC