Skip to content

Commit 98b51c2

Browse files
author
Jethro Beekman
committed
Add SGX-specific notes to the documentation
1 parent 4530d64 commit 98b51c2

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

src/lib.rs

+38
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,44 @@ mod sealed {
139139
pub trait Sealed {}
140140
}
141141

142+
/// # Information about using *ring* in SGX
143+
///
144+
/// ## CPU feature detection
145+
/// On `x86_64-fortanix-unknown-sgx`, feature detection is done using the
146+
/// `std::is_x86_feature_detected` macro, which currently only supports
147+
/// features enabled at compile-time. You must enable at least the `aes` and
148+
/// `pclmul` features, otherwise *ring* will panic at runtime. See the [GitHub
149+
/// issue](https://github.com/fortanix/rust-sgx/issues/26) for more
150+
/// information.
151+
///
152+
/// To set compile-time features, you can either specify them as an environment
153+
/// variable:
154+
///
155+
/// ```text
156+
/// RUSTFLAGS="-C target-feature=+aes,+pclmul"
157+
/// ```
158+
///
159+
/// Or you may configure them per target in [`.cargo/config`].
160+
///
161+
/// [`.cargo/config`]: https://doc.rust-lang.org/cargo/reference/config.html#configuration-keys
162+
///
163+
/// ## Entropy source
164+
/// The entropy source used in SGX is the hardware random number generator
165+
/// provided by the RDRAND instruction.
166+
///
167+
/// ## Nightly only
168+
/// The `x86_64-fortanix-unknown-sgx` target is only available on nightly, and
169+
/// *ring* Continuous Builds only build it for nightly. See the [GitHub
170+
/// issue](https://github.com/briansmith/ring/issues/779) for more information.
171+
///
172+
/// ## Continuous Testing
173+
/// While the *ring* test suite works in SGX, and it is run manually from time
174+
/// to time, it doesn't run automatically as part of a Continuous Testing
175+
/// setup. See the [GitHub issue](https://github.com/briansmith/ring/issues/778)
176+
/// for more information.
177+
#[cfg(target_env = "sgx")]
178+
pub mod sgx {}
179+
142180
#[cfg(test)]
143181
mod tests {
144182
bssl_test!(test_constant_time, bssl_constant_time_test_main);

0 commit comments

Comments
 (0)