diff options
author | Dmitry Antipov <dantipov@cloudlinux.com> | 2023-05-03 10:32:28 +0300 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2023-05-16 23:29:32 +0000 |
commit | cea9b25571f1956e09fc376e1127f78c6f9a4a19 (patch) | |
tree | 7f926586451fd1b462764b5546ccb66cf4978462 /lib/util | |
parent | 72335e742e041ea213598a62ae165edeed4b8c99 (diff) | |
download | samba-cea9b25571f1956e09fc376e1127f78c6f9a4a19.tar.gz |
lib:util: prefer size_t for random data generation functions
Prefer 'size_t' over 'int' in generate_random_buffer(),
generate_secret_buffer() and generate_nonce_buffer() to
match an underlying gnutls_rnd() calls.
Signed-off-by: Dmitry Antipov <dantipov@cloudlinux.com>
Reviewed-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Diffstat (limited to 'lib/util')
-rw-r--r-- | lib/util/genrand.c | 8 | ||||
-rw-r--r-- | lib/util/genrand.h | 6 |
2 files changed, 7 insertions, 7 deletions
diff --git a/lib/util/genrand.c b/lib/util/genrand.c index fd6f457d27d..d0b49db1423 100644 --- a/lib/util/genrand.c +++ b/lib/util/genrand.c @@ -45,7 +45,7 @@ _NORETURN_ static void genrand_panic(int err, } -_PUBLIC_ void generate_random_buffer(uint8_t *out, int len) +_PUBLIC_ void generate_random_buffer(uint8_t *out, size_t len) { /* Random number generator for temporary keys. */ int ret = gnutls_rnd(GNUTLS_RND_RANDOM, out, len); @@ -54,7 +54,7 @@ _PUBLIC_ void generate_random_buffer(uint8_t *out, int len) } } -_PUBLIC_ void generate_secret_buffer(uint8_t *out, int len) +_PUBLIC_ void generate_secret_buffer(uint8_t *out, size_t len) { /* * Random number generator for long term keys. @@ -62,7 +62,7 @@ _PUBLIC_ void generate_secret_buffer(uint8_t *out, int len) * 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 + * the limit for a re-seed. For its re-seed it mixes data obtained * from the OS random device with the previous key. */ int ret = gnutls_rnd(GNUTLS_RND_KEY, out, len); @@ -71,7 +71,7 @@ _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, size_t len) { /* * Random number generator for nonce and initialization vectors. diff --git a/lib/util/genrand.h b/lib/util/genrand.h index 70f36312e58..76e9b987dcf 100644 --- a/lib/util/genrand.h +++ b/lib/util/genrand.h @@ -26,7 +26,7 @@ * * @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, size_t len); /** * @brief Generate random values for long term keys and passwords. @@ -35,7 +35,7 @@ void generate_random_buffer(uint8_t *out, int len); * * @param[in] len The size of the buffer to fill. */ -void generate_secret_buffer(uint8_t *out, int len); +void generate_secret_buffer(uint8_t *out, size_t len); /** * @brief Generate random values for a nonce buffer. @@ -46,4 +46,4 @@ void generate_secret_buffer(uint8_t *out, int len); * * @param[in] len The size of the buffer to fill. */ -void generate_nonce_buffer(uint8_t *out, int len); +void generate_nonce_buffer(uint8_t *out, size_t len); |