@@ -22,18 +22,14 @@ execution features which might introduce timing or other microarchitectural
2222sidechannels introduced by branch prediction or other speculative execution
2323features.
2424
25- Intel has confirmed that all extant CPUs implement the CMOV family of
26- instructions in constant-time, and that this property will hold for future
27- Intel CPUs as well.
28-
2925This crate provides wrappers for the CMOV/CSEL instructions implemented using
30- inline assembly as stabilized in Rust 1.59. This means the implementation
31- is a black box that will not be rewritten by e.g. LLVM's architecture-specific
32- lowerings, such as the [ x86-cmov-conversion] pass.
26+ inline ` asm! ` , which means the implementation is a black box that will not be
27+ rewritten by e.g. LLVM's architecture-specific lowerings, such as the
28+ [ x86-cmov-conversion] pass.
3329
3430## Supported target architectures
3531
36- This crate provides guaranteed constant-time operation using inline assembly
32+ This crate provides guaranteed constant-time operation using inline ` asm! `
3733on the following CPU architectures:
3834
3935- [x] ` x86 ` (` CMOVZ ` , ` CMOVNZ ` )
@@ -42,11 +38,33 @@ on the following CPU architectures:
4238- [x] ` aarch64 ` (` CSEL ` )
4339
4440On other target architectures, a "best effort" portable fallback implementation
45- based on bitwise arithmetic is used instead. However, we cannot guarantee that
46- this implementation generates branch-free code.
41+ based on bitwise arithmetic is used instead, augmented with tactical usage of
42+ ` core::hint::black_box ` based on past analysis of the generated assembly.
43+ However, we cannot guarantee that this implementation generates branch-free
44+ code, especially on hypothetical future rustc versions which introduce new
45+ optimizations.
46+
47+ Please [ open an issue] if you notice non-constant-time CPU instructions
48+ (e.g. branches, secret-dependent address calculations) being generated and we
49+ will treat it as a security issue and do our best to find a solution.
50+
51+ You can also open an issue to request first-class support for native
52+ predication instructions on other architectures we don't currently support.
53+
54+ ### ` x86 ` / ` x86_64 ` notes
55+
56+ Intel has confirmed that all extant CPUs implement the CMOV family of
57+ instructions in constant-time, and that this property will hold for future
58+ Intel CPUs as well.
59+
60+ ## ⚠️ Security Warning
61+
62+ The implementation contained in this crate has never been independently audited!
63+ USE AT YOUR OWN RISK!
64+
65+ Below are security issues this crate has experienced in the past:
4766
48- It's possible to extend constant-time guarantees to other CPU architectures.
49- Please open an issue with your desired CPU architecture if this interests you.
67+ - [ RUSTSEC-2026-0003] : Non-constant-time code generation on ARM32 targets
5068
5169## Minimum Supported Rust Version (MSRV) Policy
5270
@@ -91,3 +109,5 @@ dual licensed as above, without any additional terms or conditions.
91109[ CSEL ] : https://developer.arm.com/documentation/dui0802/b/CSEL
92110[ predication ] : https://en.wikipedia.org/wiki/Predication_(computer_architecture)
93111[ x86-cmov-conversion ] : https://dsprenkels.com/cmov-conversion.html
112+ [ open an issue ] : https://github.com/RustCrypto/utils/issues
113+ [ RUSTSEC-2026-0003 ] : https://rustsec.org/advisories/RUSTSEC-2026-0003.html
0 commit comments