aboutsummaryrefslogtreecommitdiff
path: root/openssl/src
diff options
context:
space:
mode:
authorjohnthagen <[email protected]>2017-09-28 09:49:03 -0400
committerjohnthagen <[email protected]>2017-09-28 09:49:03 -0400
commit220c707fd95de3f3230365a8ee9dd8789a1ee421 (patch)
tree5906ddb20ef9b71a344e56030b7f4ada94132988 /openssl/src
parentFix rerun logic (diff)
downloadrust-openssl-220c707fd95de3f3230365a8ee9dd8789a1ee421.tar.xz
rust-openssl-220c707fd95de3f3230365a8ee9dd8789a1ee421.zip
Document rand module
Diffstat (limited to 'openssl/src')
-rw-r--r--openssl/src/rand.rs18
1 files changed, 18 insertions, 0 deletions
diff --git a/openssl/src/rand.rs b/openssl/src/rand.rs
index c1c49e7b..9fe22226 100644
--- a/openssl/src/rand.rs
+++ b/openssl/src/rand.rs
@@ -1,9 +1,27 @@
+//! Cryptographically strong random bytes.
+//!
+//! This module exposes functionality to put cryptographically strong
+//! pseudo-random bytes into a buffer.
+//!
+//! # Examples
+//!
+//! To generate a buffer with cryptographically strong bytes:
+//!
+//! ```
+//! let muf buf = [0; 256]
+//! rand_bytes(&mut buf).unwrap();
+//! ```
+//!
+//! # External OpenSSL Documentation
+//!
+//! [RAND_bytes](https://www.openssl.org/docs/man1.1.0/crypto/RAND_bytes.html)
use libc::c_int;
use ffi;
use cvt;
use error::ErrorStack;
+/// Fills buffer with cryptographically strong pseudo-random bytes.
pub fn rand_bytes(buf: &mut [u8]) -> Result<(), ErrorStack> {
unsafe {
ffi::init();