1
0
mirror of https://github.com/samba-team/samba.git synced 2025-02-28 01:58:17 +03:00

lib:util: Fix documentation for random number functions

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
This commit is contained in:
Andreas Schneider 2019-08-12 16:10:20 +02:00 committed by Alexander Bokovoy
parent 4d276a93fc
commit 97c441d7c2
2 changed files with 13 additions and 4 deletions

View File

@ -33,13 +33,16 @@
_PUBLIC_ void generate_random_buffer(uint8_t *out, int len) _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); gnutls_rnd(GNUTLS_RND_RANDOM, out, len);
} }
_PUBLIC_ void generate_secret_buffer(uint8_t *out, int 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 * generated (typically less than the nonce), and will also re-seed
* based on time, i.e., after few hours of operation without reaching * 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 * 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) _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 * The nonce generator will reseed after outputting a fixed amount of
* bytes (typically few megabytes), or after few hours of operation * bytes (typically few megabytes), or after few hours of operation
* without reaching the limit has passed. * without reaching the limit has passed.

View File

@ -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); 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. * @param[in] out A pointer to the buffer to fill with random data.
* *