Skip to content

Commit 1e06074

Browse files
committed
Fix missing docs
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
1 parent 155c7c1 commit 1e06074

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)