Skip to content

Commit 018f71f

Browse files
committed
Merge #861: Fix missing docs
1e06074 Fix missing docs (Tobin C. Harding) Pull request description: Process fail, we cut the docs off on these two functions. Fix the docs using text taken directly from Poelstra's post on the issue. Close #847 ACKs for top commit: apoelstra: ACK 1e06074; successfully ran local tests except for the flakey one Tree-SHA512: b8de71a73924e68022712432a2c3921f93a983e8f80496a6fa334fb5816b23b4bd6b6cdea551db2bb0062f60e305988c8c7d9b0b976a0392cf8234e63631b6bf
2 parents c3b151a + 1e06074 commit 018f71f

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

src/context/internal_std.rs

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,13 @@ thread_local! {
1515

1616
/// Borrows the global context and does some operation on it.
1717
///
18-
/// If provided, after the operation is complete, [`rerandomize_global_context`]
19-
/// is called on the context. If you have some random data available,
18+
/// If `rerandomize_seed` is provided, then [`rerandomize_global_context`] is called on the context
19+
/// after the operation. This argument should be provided alongside any operation that uses secret
20+
/// data (e.g. signing, but not verification). If you have random data available, it should be
21+
/// provided here; it will be mixed with the current random state as well as the system RNG if it is
22+
/// available. If you do not have any random data, it is fine to provide all zeros, or a counter, or
23+
/// a weak source of entropy. This is a defense-in-depth measure to protect against side-channel
24+
/// attacks, and anything helps (and nothing will hurt).
2025
pub fn with_global_context<T, Ctx: Context, F: FnOnce(&Secp256k1<Ctx>) -> T>(
2126
f: F,
2227
rerandomize_seed: Option<&[u8; 32]>,
@@ -32,8 +37,13 @@ pub fn with_global_context<T, Ctx: Context, F: FnOnce(&Secp256k1<Ctx>) -> T>(
3237

3338
/// Borrows the global context as a raw pointer and does some operation on it.
3439
///
35-
/// If provided, after the operation is complete, [`rerandomize_global_context`]
36-
/// is called on the context. If you have some random data available,
40+
/// If `rerandomize_seed` is provided, then [`rerandomize_global_context`] is called on the context
41+
/// after the operation. This argument should be provided alongside any operation that uses secret
42+
/// data (e.g. signing, but not verification). If you have random data available, it should be
43+
/// provided here; it will be mixed with the current random state as well as the system RNG if it is
44+
/// available. If you do not have any random data, it is fine to provide all zeros, or a counter, or
45+
/// a weak source of entropy. This is a defense-in-depth measure to protect against side-channel
46+
/// attacks, and anything helps (and nothing will hurt).
3747
pub fn with_raw_global_context<T, F: FnOnce(NonNull<ffi::Context>) -> T>(
3848
f: F,
3949
rerandomize_seed: Option<&[u8; 32]>,

0 commit comments

Comments
 (0)