-
Notifications
You must be signed in to change notification settings - Fork 786
Closed as not planned
Description
Various people want ring to work on SGX. Here's what needs to be done to have a decent port, AFAICT:
- Replace the use of CPUID in cpu-intel.c with something SGX-compatible for SGX targets. Baidu patched ring to use
sgx_cpuid. - Change
detect_implementation()in aes.rs so that SGX targets will only use the constant-time AES-NI or constant-time VPAES implementations, and never any of the other leaky implementations. - Change
detect_implementation()in gcm.rs so that SGX will only use the constant-timeCLMULimplementation or the ghash-ssse3-x86_64.pl implementation (which hasn't been imported from BoringSSL yet), and never any of the other leaky implementations. - For SGX targets only, change rand.rs for SGX targets to use RDRAND via the BoringSSL rdrand-x86_64.pl. I filed https://bugs.chromium.org/p/boringssl/issues/detail?id=262 to ask the BoringSSL developers about the lack of retry logic in that code. Document clearly in the
ring:randdocumentation that on SGX only,RDRANDis used. - Remove use of
fprintffrom the constant_time_test.c. - Merge Replace libstd with spin crate in
cpu::cache_detected_features. #759: Usespin::Onceinstead ofstd::sync::Oncein cpu.rs. (Needed by Baidu only, not Fortanix). - Update Travis CI to build SGX test target. Take this from Add support for x86_64-fortanix-unknown-sgx target #738.
- Create a new document for SGX-specific issues:
- Document SGX-specific risks with how feature detection is done. In particular, document that because the CPU feature detection is done outside of the enclave, it can be tampered with, and because we rely on the results of this feature detection, it is possible for untrusted code outside of the enclave to trick us into thinking that a CPU instruction is available when it is not, and thus they can force us to halt the enclave with an illegal instruction fault.
- Warn in this document, in addition to the
ring::randAPI documentation, thatring::randis implemented solely in terms ofRDRANDfor SGX targets. - Document that SGX tests aren't run in CI. File a new issue in the issue tracker and link to the issue in this section of this new SGX-specific documentation.
- Document that the SGX port is tested to build correctly only in Nightly Rust. File a new issue in the issue tracker about adding stable and beta channel support, and link to the issue in this section of this new SGX-specific documentation.
Is there anything else that needs to be done to properly support SGX?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels