We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 8ae20b5 commit 9330f24Copy full SHA for 9330f24
1 file changed
src/rdrand.rs
@@ -31,13 +31,14 @@ unsafe fn rdrand() -> Result<[u8; WORD_SIZE], Error> {
31
Err(Error::UNKNOWN)
32
}
33
34
+#[cfg(and(target_env = "sgx", not(target_feature = "rdrand")))]
35
+compile_error!("SGX targets must enable RDRAND to get randomness");
36
+
37
// TODO use is_x86_feature_detected!("rdrand") when that works in core. See:
38
// https://github.com/rust-lang-nursery/stdsimd/issues/464
39
fn is_rdrand_supported() -> bool {
40
if cfg!(target_feature = "rdrand") {
41
true
- } else if cfg!(target_env = "sgx") {
- false // No CPUID in SGX enclaves
42
} else {
43
// SAFETY: All x86_64 CPUs support CPUID leaf 1
44
const FLAG: u32 = 1 << 30;
0 commit comments