diff options
author | Jack Lloyd <[email protected]> | 2015-11-28 11:43:00 -0500 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2015-11-28 11:43:00 -0500 |
commit | 466cc0fb0b1a072584c26f0949d377510c440d0d (patch) | |
tree | 1ddf0107d788b1696304bdb604fe685a63163d5e /src/lib/entropy/hres_timer/hres_timer.cpp | |
parent | 3bdf9d1bd8345fc2aa0f1c5ec0261921a77988cf (diff) |
Push the hardcoded entropy estimates up to build.h
Defaults should be fine for everyone but it makes the values more transparent
Diffstat (limited to 'src/lib/entropy/hres_timer/hres_timer.cpp')
-rw-r--r-- | src/lib/entropy/hres_timer/hres_timer.cpp | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/src/lib/entropy/hres_timer/hres_timer.cpp b/src/lib/entropy/hres_timer/hres_timer.cpp index 6efa3b188..0b39c935a 100644 --- a/src/lib/entropy/hres_timer/hres_timer.cpp +++ b/src/lib/entropy/hres_timer/hres_timer.cpp @@ -26,16 +26,13 @@ namespace Botan { */ void High_Resolution_Timestamp::poll(Entropy_Accumulator& accum) { - // Don't count any timestamps as contributing any entropy - const double ESTIMATED_ENTROPY_PER_BYTE = 0.0; - #if defined(BOTAN_TARGET_OS_HAS_CLOCK_GETTIME) -#define CLOCK_GETTIME_POLL(src) \ - do { \ - struct timespec ts; \ - ::clock_gettime(src, &ts); \ - accum.add(&ts, sizeof(ts), ESTIMATED_ENTROPY_PER_BYTE); \ +#define CLOCK_GETTIME_POLL(src) \ + do { \ + struct timespec ts; \ + ::clock_gettime(src, &ts); \ + accum.add(&ts, sizeof(ts), BOTAN_ENTROPY_ESTIMATE_TIMESTAMPS); \ } while(0) #if defined(CLOCK_REALTIME) @@ -65,7 +62,7 @@ void High_Resolution_Timestamp::poll(Entropy_Accumulator& accum) #define STD_CHRONO_POLL(clock) \ do { \ auto timestamp = clock::now().time_since_epoch().count(); \ - accum.add(timestamp, ESTIMATED_ENTROPY_PER_BYTE); \ + accum.add(timestamp, BOTAN_ENTROPY_ESTIMATE_TIMESTAMPS); \ } while(0) STD_CHRONO_POLL(std::chrono::high_resolution_clock); @@ -109,7 +106,7 @@ void High_Resolution_Timestamp::poll(Entropy_Accumulator& accum) #endif - accum.add(rtc, ESTIMATED_ENTROPY_PER_BYTE); + accum.add(rtc, BOTAN_ENTROPY_ESTIMATE_TIMESTAMPS); #endif @@ -117,7 +114,7 @@ void High_Resolution_Timestamp::poll(Entropy_Accumulator& accum) { LARGE_INTEGER tv; ::QueryPerformanceCounter(&tv); - accum.add(tv.QuadPart, ESTIMATED_ENTROPY_PER_BYTE); + accum.add(tv.QuadPart, BOTAN_ENTROPY_ESTIMATE_TIMESTAMPS); } #endif } |