File tree 1 file changed +19
-3
lines changed
1 file changed +19
-3
lines changed Original file line number Diff line number Diff line change @@ -191,16 +191,32 @@ mod alloc_only {
191
191
}
192
192
193
193
impl Secp256k1 < All > {
194
- /// Creates a new Secp256k1 context with all capabilities
194
+ /// Creates a new Secp256k1 context with all capabilities.
195
+ ///
196
+ /// If `rand-std` feature is enabled, context will have been randomized using `thread_rng`.
197
+ #[ allow( unused_mut) ] // Unused when `rand-std` is not enabled.
195
198
pub fn new ( ) -> Secp256k1 < All > {
196
- Secp256k1 :: gen_new ( )
199
+ let mut ctx = Secp256k1 :: gen_new ( ) ;
200
+ #[ cfg( feature = "rand-std" ) ]
201
+ {
202
+ ctx. randomize ( & mut rand:: thread_rng ( ) ) ;
203
+ }
204
+ ctx
197
205
}
198
206
}
199
207
200
208
impl Secp256k1 < SignOnly > {
201
209
/// Creates a new Secp256k1 context that can only be used for signing
210
+ ///
211
+ /// If `rand-std` feature is enabled, context will have been randomized using `thread_rng`.
212
+ #[ allow( unused_mut) ] // Unused when `rand-std` is not enabled.
202
213
pub fn signing_only ( ) -> Secp256k1 < SignOnly > {
203
- Secp256k1 :: gen_new ( )
214
+ let mut ctx = Secp256k1 :: gen_new ( ) ;
215
+ #[ cfg( feature = "rand-std" ) ]
216
+ {
217
+ ctx. randomize ( & mut rand:: thread_rng ( ) ) ;
218
+ }
219
+ ctx
204
220
}
205
221
}
206
222
You can’t perform that action at this time.
0 commit comments