5 stable releases
|2.2.1||Sep 28, 2019|
|2.1.1||Jul 31, 2019|
|2.0.0||Dec 13, 2018|
#7 in Cryptography
96,713 downloads per month
Used in 643 crates (45 directly)
Pure-Rust traits and utilities for constant-time cryptographic implementations.
It consists of a
Choice type, and a collection of traits using
bool which are intended to execute in constant-time. The
type is a wrapper around a
u8 that holds a
This crate represents a “best-effort” attempt, since side-channels are ultimately a property of a deployed cryptographic system including the hardware it runs on, not just of software.
The traits are implemented using bitwise operations, and should execute in constant time provided that a) the bitwise operations are constant-time and b) the operations are not optimized into a branch.
To prevent the latter possibility, when using the
(recommended), the crate attempts to hide the value of a
from the optimizer, by passing it through an inline assembly block. For more
information, see the About section below.
[dependencies.subtle] version = "2.1" features = ["nightly"]
nightlyfeature enables the use of an optimization barrier to protect the
Choicetype. Using the
nightlyfeature is recommended for security.
Documentation is available here.
This library aims to be the Rust equivalent of Go’s
The optimization barrier in
impl From<u8> for Choice was based on Tim
Maclean's work on
rust-timing-shield, which attempts to
provide a more comprehensive approach for preventing software side-channels in
subtle is authored by isis agora lovecruft and Henry de Valence.
This code is a low-level library, intended for specific use-cases implementing cryptographic protocols. It represents a best-effort attempt to protect against some software side-channels. Because side-channel resistance is not a property of software alone, but of software together with hardware, any such effort is fundamentally limited.
USE AT YOUR OWN RISK