You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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-time CLMUL 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.
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, that ring::rand is implemented solely in terms of RDRAND 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?
Various people want ring to work on SGX. Here's what needs to be done to have a decent port, AFAICT:
sgx_cpuid.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.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.ring:randdocumentation that on SGX only,RDRANDis used.fprintffrom the constant_time_test.c.cpu::cache_detected_features. #759: Usespin::Onceinstead ofstd::sync::Oncein cpu.rs. (Needed by Baidu only, not Fortanix).ring::randAPI documentation, thatring::randis implemented solely in terms ofRDRANDfor SGX targets.Is there anything else that needs to be done to properly support SGX?