4141//! inner `u8` by passing it through a volatile read. For more information, see
4242//! the _About_ section below.
4343//!
44- //! Rust versions from 1.66 or higher support a new best-effort optimization
45- //! barrier ([`core::hint::black_box`]). To use the new optimization barrier,
46- //! enable the `core_hint_black_box` feature.
47- //!
4844//! Rust versions from 1.51 or higher have const generics support. You may enable
4945//! `const-generics` feautre to have `subtle` traits implemented for arrays `[T; N]`.
5046//!
7470//! based on Tim Maclean's [work on `rust-timing-shield`][rust-timing-shield],
7571//! which attempts to provide a more comprehensive approach for preventing
7672//! software side-channels in Rust code.
77- //!
7873//! From version `2.2`, it was based on Diane Hosfelt and Amber Sprenkels' work on
79- //! "Secret Types in Rust". Version `2.5` adds the `core_hint_black_box` feature,
80- //! which uses the original method through the [`core::hint::black_box`] function
81- //! from the Rust standard library.
74+ //! "Secret Types in Rust".
8275//!
8376//! `subtle` is authored by isis agora lovecruft and Henry de Valence.
8477//!
9386//! **USE AT YOUR OWN RISK**
9487//!
9588//! [docs]: https://docs.rs/subtle
96- //! [`core::hint::black_box`]: https://doc.rust-lang.org/core/hint/fn.black_box.html
9789//! [rust-timing-shield]: https://www.chosenplaintext.ca/open-source/rust-timing-shield/security
9890
9991#[ cfg( feature = "std" ) ]
@@ -224,7 +216,6 @@ impl Not for Choice {
224216/// Note: Rust's notion of "volatile" is subject to change over time. While this
225217/// code may break in a non-destructive way in the future, “constant-time” code
226218/// is a continually moving target, and this is better than doing nothing.
227- #[ cfg( not( feature = "core_hint_black_box" ) ) ]
228219#[ inline( never) ]
229220fn black_box ( input : u8 ) -> u8 {
230221 debug_assert ! ( ( input == 0u8 ) | ( input == 1u8 ) ) ;
@@ -242,13 +233,6 @@ fn black_box(input: u8) -> u8 {
242233 }
243234}
244235
245- #[ cfg( feature = "core_hint_black_box" ) ]
246- #[ inline( never) ]
247- fn black_box ( input : u8 ) -> u8 {
248- debug_assert ! ( ( input == 0u8 ) | ( input == 1u8 ) ) ;
249- core:: hint:: black_box ( input)
250- }
251-
252236impl From < u8 > for Choice {
253237 #[ inline]
254238 fn from ( input : u8 ) -> Choice {
0 commit comments