1524bc
From 5d53f417762503b9c73edcdb1364834f3b665e74 Mon Sep 17 00:00:00 2001
1524bc
From: Andreas Schneider <asn@samba.org>
1524bc
Date: Mon, 12 Aug 2019 16:10:20 +0200
1524bc
Subject: [PATCH 075/187] lib:util: Fix documentation for random number
1524bc
 functions
1524bc
1524bc
Signed-off-by: Andreas Schneider <asn@samba.org>
1524bc
Reviewed-by: Alexander Bokovoy <ab@samba.org>
1524bc
(cherry picked from commit 97c441d7c28feb29168e81ebbc5c55b09a845087)
1524bc
---
1524bc
 lib/util/genrand.c | 9 +++++++--
1524bc
 lib/util/genrand.h | 8 ++++++--
1524bc
 2 files changed, 13 insertions(+), 4 deletions(-)
1524bc
1524bc
diff --git a/lib/util/genrand.c b/lib/util/genrand.c
1524bc
index a5809aa2bc9..18ffa0d95e6 100644
1524bc
--- a/lib/util/genrand.c
1524bc
+++ b/lib/util/genrand.c
1524bc
@@ -33,13 +33,16 @@
1524bc
 
1524bc
 _PUBLIC_ void generate_random_buffer(uint8_t *out, int len)
1524bc
 {
1524bc
-	/* Thread and fork safe random number generator for temporary keys. */
1524bc
+	/* Random number generator for temporary keys. */
1524bc
 	gnutls_rnd(GNUTLS_RND_RANDOM, out, len);
1524bc
 }
1524bc
 
1524bc
 _PUBLIC_ void generate_secret_buffer(uint8_t *out, int len)
1524bc
 {
1524bc
-	/* The key generator, will re-seed after a fixed amount of bytes is
1524bc
+	/*
1524bc
+	 * Random number generator for long term keys.
1524bc
+	 *
1524bc
+	 * The key generator, will re-seed after a fixed amount of bytes is
1524bc
 	 * generated (typically less than the nonce), and will also re-seed
1524bc
 	 * based on time, i.e., after few hours of operation without reaching
1524bc
 	 * the limit for a re-seed. For its re-seed it mixes mixes data obtained
1524bc
@@ -51,6 +54,8 @@ _PUBLIC_ void generate_secret_buffer(uint8_t *out, int len)
1524bc
 _PUBLIC_ void generate_nonce_buffer(uint8_t *out, int len)
1524bc
 {
1524bc
 	/*
1524bc
+	 * Random number generator for nonce and initialization vectors.
1524bc
+	 *
1524bc
 	 * The nonce generator will reseed after outputting a fixed amount of
1524bc
 	 * bytes (typically few megabytes), or after few hours of operation
1524bc
 	 * without reaching the limit has passed.
1524bc
diff --git a/lib/util/genrand.h b/lib/util/genrand.h
1524bc
index abb8ce2c10a..70f36312e58 100644
1524bc
--- a/lib/util/genrand.h
1524bc
+++ b/lib/util/genrand.h
1524bc
@@ -20,12 +20,16 @@
1524bc
 */
1524bc
 
1524bc
 /**
1524bc
- * Thread and fork safe random number generator for temporary keys.
1524bc
+ * @brief Generate random values for session and temporary keys.
1524bc
+ *
1524bc
+ * @param[in]  out  A pointer to the buffer to fill with random data.
1524bc
+ *
1524bc
+ * @param[in]  len  The size of the buffer to fill.
1524bc
  */
1524bc
 void generate_random_buffer(uint8_t *out, int len);
1524bc
 
1524bc
 /**
1524bc
- * @brief Generate random values for key buffers (e.g. session keys)
1524bc
+ * @brief Generate random values for long term keys and passwords.
1524bc
  *
1524bc
  * @param[in]  out  A pointer to the buffer to fill with random data.
1524bc
  *
1524bc
-- 
1524bc
2.23.0
1524bc