diff options
author | lloyd <[email protected]> | 2009-12-01 12:00:48 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2009-12-01 12:00:48 +0000 |
commit | 874dbb8323dd4d7eff3ff16cff0cfafc16ddbfa7 (patch) | |
tree | bc3a84c43c5924119972f24da3af89317694f0cb /src/rng/auto_rng/auto_rng.cpp | |
parent | 78f5726220b637cd8ae117bbcf8ff8d6c8dfeaed (diff) |
Consolidate the non-canonical epoch timers, like cpuid and Win32's
QueryPerformanceCounter, into an entropy source hres_timer. Its
results, if any, do not count as contributing entropy to the poll.
Convert the other (monotonic/fixed epoch) timers to a single function
get_nanoseconds_clock(), living in time.h, which statically chooses
the 'best' timer type (clock_gettime, gettimeofday, std::clock, in
that order depending on what is available). Add feature test macros
for clock_gettime and gettimeofday.
Remove the Timer class and timer.h. Remove the Timer& argument to the
algorithm benchmark function.
Diffstat (limited to 'src/rng/auto_rng/auto_rng.cpp')
-rw-r--r-- | src/rng/auto_rng/auto_rng.cpp | 29 |
1 files changed, 4 insertions, 25 deletions
diff --git a/src/rng/auto_rng/auto_rng.cpp b/src/rng/auto_rng/auto_rng.cpp index f02a9249f..6906d9d17 100644 --- a/src/rng/auto_rng/auto_rng.cpp +++ b/src/rng/auto_rng/auto_rng.cpp @@ -7,7 +7,6 @@ #include <botan/auto_rng.h> #include <botan/parsing.h> -#include <botan/timer.h> #include <botan/hmac.h> #include <botan/sha2_32.h> #include <botan/sha2_64.h> @@ -28,20 +27,8 @@ #include <botan/aes.h> #endif -#if defined(BOTAN_HAS_TIMER_HARDWARE) - #include <botan/tm_hard.h> -#endif - -#if defined(BOTAN_HAS_TIMER_POSIX) - #include <botan/tm_posix.h> -#endif - -#if defined(BOTAN_HAS_TIMER_UNIX) - #include <botan/tm_unix.h> -#endif - -#if defined(BOTAN_HAS_TIMER_WIN32) - #include <botan/tm_win32.h> +#if defined(BOTAN_HAS_ENTROPY_SRC_HIGH_RESOLUTION_TIMER) + #include <botan/hres_timer.h> #endif #if defined(BOTAN_HAS_ENTROPY_SRC_DEVICE) @@ -81,16 +68,8 @@ namespace { */ void add_entropy_sources(RandomNumberGenerator* rng) { - - // Add a high resolution timer, if available -#if defined(BOTAN_HAS_TIMER_HARDWARE) - rng->add_entropy_source(new Hardware_Timer); -#elif defined(BOTAN_HAS_TIMER_POSIX) - rng->add_entropy_source(new POSIX_Timer); -#elif defined(BOTAN_HAS_TIMER_UNIX) - rng->add_entropy_source(new Unix_Timer); -#elif defined(BOTAN_HAS_TIMER_WIN32) - rng->add_entropy_source(new Win32_Timer); +#if defined(BOTAN_HAS_ENTROPY_SRC_HIGH_RESOLUTION_TIMER) + rng->add_entropy_source(new High_Resolution_Timestamp); #endif #if defined(BOTAN_HAS_ENTROPY_SRC_DEVICE) |