File tree Expand file tree Collapse file tree 2 files changed +8
-1
lines changed Expand file tree Collapse file tree 2 files changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -27,6 +27,13 @@ rand-std = ["rand/std"]
27
27
recovery = [" secp256k1-sys/recovery" ]
28
28
lowmemory = [" secp256k1-sys/lowmemory" ]
29
29
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 = []
30
37
31
38
[dependencies ]
32
39
secp256k1-sys = { version = " 0.4.2" , default-features = false , path = " ./secp256k1-sys" }
Original file line number Diff line number Diff line change @@ -48,7 +48,7 @@ pub mod global {
48
48
static mut CONTEXT : Option < Secp256k1 < All > > = None ;
49
49
ONCE . call_once ( || unsafe {
50
50
let mut ctx = Secp256k1 :: new ( ) ;
51
- #[ cfg( feature = "rand-std" ) ]
51
+ #[ cfg( all ( feature = "rand-std" , not ( feature = "global-context-less-secure" ) ) ) ]
52
52
{
53
53
ctx. randomize ( & mut rand:: thread_rng ( ) ) ;
54
54
}
You can’t perform that action at this time.
0 commit comments