Skip to content

Commit 2a25e5e

Browse files
committed
restore global-context-less-secure feature
1 parent ef59aea commit 2a25e5e

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

Cargo.toml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,13 @@ rand-std = ["rand/std"]
2727
recovery = ["secp256k1-sys/recovery"]
2828
lowmemory = ["secp256k1-sys/lowmemory"]
2929
global-context = ["std"]
30+
# disable re-randomization of the global context, which provides some
31+
# defense-in-depth against sidechannel attacks. You should only use
32+
# this feature if you expect the `rand` crate's thread_rng to panic.
33+
# (If you are sure the `rand-std` feature will not be enabled, e.g.
34+
# if you are doing a no-std build, then this feature does nothing
35+
# and is not necessary.)
36+
global-context-less-secure = []
3037

3138
[dependencies]
3239
secp256k1-sys = { version = "0.4.2", default-features = false, path = "./secp256k1-sys" }

src/context.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ pub mod global {
4848
static mut CONTEXT: Option<Secp256k1<All>> = None;
4949
ONCE.call_once(|| unsafe {
5050
let mut ctx = Secp256k1::new();
51-
#[cfg(feature = "rand-std")]
51+
#[cfg(all(feature = "rand-std", not(feature = "global-context-less-secure")))]
5252
{
5353
ctx.randomize(&mut rand::thread_rng());
5454
}

0 commit comments

Comments
 (0)