From: Andreas Schneider Date: Mon, 12 Aug 2019 14:10:20 +0000 (+0200) Subject: lib:util: Fix documentation for random number functions X-Git-Tag: tdb-1.4.2~120 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=97c441d7c28feb29168e81ebbc5c55b09a845087;p=thirdparty%2Fsamba.git lib:util: Fix documentation for random number functions Signed-off-by: Andreas Schneider Reviewed-by: Alexander Bokovoy --- diff --git a/lib/util/genrand.c b/lib/util/genrand.c index a5809aa2bc9..18ffa0d95e6 100644 --- a/lib/util/genrand.c +++ b/lib/util/genrand.c @@ -33,13 +33,16 @@ _PUBLIC_ void generate_random_buffer(uint8_t *out, int len) { - /* Thread and fork safe random number generator for temporary keys. */ + /* Random number generator for temporary keys. */ gnutls_rnd(GNUTLS_RND_RANDOM, out, len); } _PUBLIC_ void generate_secret_buffer(uint8_t *out, int len) { - /* The key generator, will re-seed after a fixed amount of bytes is + /* + * Random number generator for long term keys. + * + * The key generator, will re-seed after a fixed amount of bytes is * generated (typically less than the nonce), and will also re-seed * based on time, i.e., after few hours of operation without reaching * the limit for a re-seed. For its re-seed it mixes mixes data obtained @@ -51,6 +54,8 @@ _PUBLIC_ void generate_secret_buffer(uint8_t *out, int len) _PUBLIC_ void generate_nonce_buffer(uint8_t *out, int len) { /* + * Random number generator for nonce and initialization vectors. + * * The nonce generator will reseed after outputting a fixed amount of * bytes (typically few megabytes), or after few hours of operation * without reaching the limit has passed. diff --git a/lib/util/genrand.h b/lib/util/genrand.h index abb8ce2c10a..70f36312e58 100644 --- a/lib/util/genrand.h +++ b/lib/util/genrand.h @@ -20,12 +20,16 @@ */ /** - * Thread and fork safe random number generator for temporary keys. + * @brief Generate random values for session and temporary keys. + * + * @param[in] out A pointer to the buffer to fill with random data. + * + * @param[in] len The size of the buffer to fill. */ void generate_random_buffer(uint8_t *out, int len); /** - * @brief Generate random values for key buffers (e.g. session keys) + * @brief Generate random values for long term keys and passwords. * * @param[in] out A pointer to the buffer to fill with random data. *