-
Notifications
You must be signed in to change notification settings - Fork 768
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-timeCLMUL
implementation 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:rand
documentation that on SGX only,RDRAND
is used. - Remove use of
fprintf
from the constant_time_test.c. - Merge Replace libstd with spin crate in
cpu::cache_detected_features
. #759: Usespin::Once
instead ofstd::sync::Once
in 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::rand
API documentation, thatring::rand
is implemented solely in terms ofRDRAND
for 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?
Metadata
Metadata
Assignees
Labels
No labels