diff options
author | Jack Lloyd <[email protected]> | 2016-07-18 15:39:41 -0400 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2016-07-18 15:39:41 -0400 |
commit | c64d66d355c4e3daf04a79697b7f9271d087e495 (patch) | |
tree | d85c51d0f74c91263ce3191382972635c294614b | |
parent | e33c989417b7ad9557b02936a1a814e37bf85fcd (diff) |
Fix proc_walk - would always return 0 entropy collected.
Fix BeOS stat reader - was calling wrong function on the rng.
Remove entropy estimate defines from build.h, no longer used.
-rw-r--r-- | src/build-data/buildh.in | 39 | ||||
-rw-r--r-- | src/lib/entropy/beos_stats/es_beos.cpp | 14 | ||||
-rw-r--r-- | src/lib/entropy/proc_walk/proc_walk.cpp | 3 |
3 files changed, 13 insertions, 43 deletions
diff --git a/src/build-data/buildh.in b/src/build-data/buildh.in index 222d7cab0..1d643248e 100644 --- a/src/build-data/buildh.in +++ b/src/build-data/buildh.in @@ -148,41 +148,12 @@ #define BOTAN_ENTROPY_SAFE_PATHS { "/bin", "/sbin", "/usr/bin", "/usr/sbin" } /* -* Defines the static entropy estimates which each type of source uses. -* These values are expressed as the bits of entropy per byte of -* output (in double format) and should be conservative. These are used -* unless an entropy source has some more specific opinion on the entropy -* of the underlying source. -*/ - -// We include some high resolution timestamps because it can't hurt -#define BOTAN_ENTROPY_ESTIMATE_TIMESTAMPS 0 - -// Data which is system or process specific, but otherwise static -#define BOTAN_ENTROPY_ESTIMATE_STATIC_SYSTEM_DATA 0 - -// Binary system data of some kind -#define BOTAN_ENTROPY_ESTIMATE_SYSTEM_DATA 0.5 - -// Human readable text which has entropy -#define BOTAN_ENTROPY_ESTIMATE_SYSTEM_TEXT (1.0 / 64) - -/* -The output of a hardware RNG such as RDRAND / RDSEED - -By default such RNGs are used but not trusted, so that the standard -softare-based entropy polling is still used. -*/ -#define BOTAN_ENTROPY_ESTIMATE_HARDWARE_RNG 0.0 - -/* -How often should the RdRand/RdSeed RNGs be polled - -Each poll generates 32 bit entropy +How many times to read from the RDRAND/RDSEED RNGs. +Each read generates 32 bits of output */ #define BOTAN_ENTROPY_INTEL_RNG_POLLS 32 -// According to Intel RdRand is guaranteed to generate a random number within 10 retries on a working CPU +// According to Intel, RDRAND is guaranteed to generate a random number within 10 retries on a working CPU #define BOTAN_ENTROPY_RDRAND_RETRIES 10 /* @@ -191,10 +162,6 @@ Each poll generates 32 bit entropy */ #define BOTAN_ENTROPY_RDSEED_RETRIES 20 -// The output of a PRNG we are trusting to be strong -#define BOTAN_ENTROPY_ESTIMATE_STRONG_RNG 7.0 - - /* * Compiler and target specific flags */ diff --git a/src/lib/entropy/beos_stats/es_beos.cpp b/src/lib/entropy/beos_stats/es_beos.cpp index fb9be6f86..907ca37bb 100644 --- a/src/lib/entropy/beos_stats/es_beos.cpp +++ b/src/lib/entropy/beos_stats/es_beos.cpp @@ -22,40 +22,40 @@ size_t BeOS_EntropySource::poll(RandomNumberGenerator& rng) system_info info_sys; get_system_info(&info_sys); - rng.add_entropy(info_sys); + rng.add_entropy_T(info_sys); key_info info_key; // current state of the keyboard get_key_info(&info_key); - rng.add_entropy(info_key); + rng.add_entropy_T(info_key); team_info info_team; int32 cookie_team = 0; while(get_next_team_info(&cookie_team, &info_team) == B_OK) { - rng.add_entropy(info_team); + rng.add_entropy_T(info_team); team_id id = info_team.team; int32 cookie = 0; thread_info info_thr; while(get_next_thread_info(id, &cookie, &info_thr) == B_OK) - rng.add_entropy(info_thr); + rng.add_entropy_T(info_thr); cookie = 0; image_info info_img; while(get_next_image_info(id, &cookie, &info_img) == B_OK) - rng.add_entropy(info_img); + rng.add_entropy_T(info_img); cookie = 0; sem_info info_sem; while(get_next_sem_info(id, &cookie, &info_sem) == B_OK) - rng.add_entropy(info_sem); + rng.add_entropy_T(info_sem); cookie = 0; area_info info_area; while(get_next_area_info(id, &cookie, &info_area) == B_OK) - rng.add_entropy(info_area); + rng.add_entropy_T(info_area); bits += 32; } diff --git a/src/lib/entropy/proc_walk/proc_walk.cpp b/src/lib/entropy/proc_walk/proc_walk.cpp index a0c3f830a..2664d6ad0 100644 --- a/src/lib/entropy/proc_walk/proc_walk.cpp +++ b/src/lib/entropy/proc_walk/proc_walk.cpp @@ -140,6 +140,9 @@ size_t ProcWalking_EntropySource::poll(RandomNumberGenerator& rng) if(got > 0) { rng.add_entropy(m_buf.data(), static_cast<size_t>(got)); + + // Conservative estimate of 4 bits per file + bitS += 4; } if(bits > 128) |