summaryrefslogtreecommitdiff
path: root/source4/lib/util/util.h
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2007-10-16 01:27:15 +0200
committerStefan Metzmacher <metze@samba.org>2007-12-21 05:43:03 +0100
commit6554433fc227baab93398576db703c91db1541f2 (patch)
tree13437d4d9377c247afa30e4cb946b11a7c98c01c /source4/lib/util/util.h
parent1eaefd15cb7ad20165ea4c754535986b642e24f0 (diff)
downloadsamba-6554433fc227baab93398576db703c91db1541f2.tar.gz
samba-6554433fc227baab93398576db703c91db1541f2.tar.bz2
samba-6554433fc227baab93398576db703c91db1541f2.zip
r25660: Add a new interface 'generate_secret_buffer()', to be used when we
require top-quality entropy. We don't want to waste system enropy generating challenges (which simply need to be unpredictable, not secret) or when generating UUIDs. Rework generate_random_buffer() to use /dev/urandom less often, only to seed the existing RC4 based PRNG. (With an exception to ensure we don't waste this setup cost for very small entropy requests). Perhaps we should be using heimdal's code for this instead? This should drasticly reduce our entropy use, particularly in the build farm (automated Samba build on hosts without much other source of entropy). Andrew Bartlett (This used to be commit 6a5630d37191542022f02fae519227b7829ef620)
Diffstat (limited to 'source4/lib/util/util.h')
-rw-r--r--source4/lib/util/util.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/source4/lib/util/util.h b/source4/lib/util/util.h
index 42dde70a44..fc9cb1e57a 100644
--- a/source4/lib/util/util.h
+++ b/source4/lib/util/util.h
@@ -226,10 +226,18 @@ _PUBLIC_ void set_need_random_reseed(void);
/**
Interface to the (hopefully) good crypto random number generator.
+ Will use our internal PRNG if more than 40 bytes of random generation
+ has been requested, otherwise tries to read from /dev/random
**/
_PUBLIC_ void generate_random_buffer(uint8_t *out, int len);
/**
+ Interface to the (hopefully) good crypto random number generator.
+ Will always use /dev/urandom if available.
+**/
+_PUBLIC_ void generate_secret_buffer(uint8_t *out, int len);
+
+/**
generate a single random uint32_t
**/
_PUBLIC_ uint32_t generate_random(void);