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"]
2727recovery = [" secp256k1-sys/recovery" ]
2828lowmemory = [" secp256k1-sys/lowmemory" ]
2929global-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 ]
3239secp256k1-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 {
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 }
You can’t perform that action at this time.
0 commit comments