Skip to content

Commit 9a64857

Browse files
authored
document the variation in underlying details of abstracted randomness sources (#276)
1 parent 7089766 commit 9a64857

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

src/lib.rs

+14-5
Original file line numberDiff line numberDiff line change
@@ -115,13 +115,22 @@
115115
//! entropy yet. To avoid returning low-entropy bytes, we first poll
116116
//! `/dev/random` and only switch to `/dev/urandom` once this has succeeded.
117117
//!
118+
//! On OpenBSD, this kind of entropy accounting isn't available, and on
119+
//! NetBSD, blocking on it is discouraged. On these platforms, nonblocking
120+
//! interfaces are used, even when reliable entropy may not be available.
121+
//! On the platforms where it is used, the reliability of entropy accounting
122+
//! itself isn't free from controversy. This library provides randomness
123+
//! sourced according to the platform's best practices, but each platform has
124+
//! its own limits on the grade of randomness it can promise in environments
125+
//! with few sources of entropy.
126+
//!
118127
//! ## Error handling
119128
//!
120-
//! We always choose failure over returning insecure "random" bytes. In general,
121-
//! on supported platforms, failure is highly unlikely, though not impossible.
122-
//! If an error does occur, then it is likely that it will occur on every call to
123-
//! `getrandom`, hence after the first successful call one can be reasonably
124-
//! confident that no errors will occur.
129+
//! We always choose failure over returning known insecure "random" bytes. In
130+
//! general, on supported platforms, failure is highly unlikely, though not
131+
//! impossible. If an error does occur, then it is likely that it will occur
132+
//! on every call to `getrandom`, hence after the first successful call one
133+
//! can be reasonably confident that no errors will occur.
125134
//!
126135
//! [1]: http://man7.org/linux/man-pages/man2/getrandom.2.html
127136
//! [2]: http://man7.org/linux/man-pages/man4/urandom.4.html

0 commit comments

Comments
 (0)