aboutsummaryrefslogtreecommitdiffstats
path: root/src/utils/timer
diff options
context:
space:
mode:
authorlloyd <[email protected]>2008-10-27 17:05:12 +0000
committerlloyd <[email protected]>2008-10-27 17:05:12 +0000
commitd0c2f90af8df600204636a701f8f279c17d6959c (patch)
tree62d9006f758b6429ed3f2ccc964892196223e05f /src/utils/timer
parentb33e8dec240005c50e8be3818d2ec250da8eeb17 (diff)
Substantially change Randpool's reseed logic. Now when a reseed
is requested, Randpool will first do a fast poll on each entropy source that has been registered. It will count these poll results towards the collected entropy count, with a maximum of 96 contributed bits of entropy per poll (only /dev/random reaches this, others measure at 50-60 bits typically), and a maximum of 256 for sum contribution of the fast polls. Then it will attempt slow polls of all devices until it thinks enough entropy has been collected (using the rather naive entropy_estimate function). It will count any slow poll for no more than 256 bits (100 or so is typical for every poll but /dev/random), and will attempt to collect at least 512 bits of (estimated/guessed) entropy. This tends to cause Randpool to use significantly more sources. Previously it was common, especially on systems with a /dev/random, for only one or a few sources to be used. This change helps assure that even if /dev/random and company are broken or compromised the RNG output remains secure (assuming at least some amount of entropy unguessable by the attacker can be collected via other sources). Also change AutoSeeded_RNG do an automatic poll/seed when it is created.
Diffstat (limited to 'src/utils/timer')
-rw-r--r--src/utils/timer/cpu_counter/tm_hard.h1
-rw-r--r--src/utils/timer/gettimeofday/tm_unix.h1
-rw-r--r--src/utils/timer/posix_rt/tm_posix.h1
-rw-r--r--src/utils/timer/win32_query_perf_ctr/tm_win32.h1
4 files changed, 4 insertions, 0 deletions
diff --git a/src/utils/timer/cpu_counter/tm_hard.h b/src/utils/timer/cpu_counter/tm_hard.h
index 1ed100bad..436cec22c 100644
--- a/src/utils/timer/cpu_counter/tm_hard.h
+++ b/src/utils/timer/cpu_counter/tm_hard.h
@@ -16,6 +16,7 @@ namespace Botan {
class BOTAN_DLL Hardware_Timer : public Timer
{
public:
+ std::string name() const { return "Hardware Timer"; }
u64bit clock() const;
};
diff --git a/src/utils/timer/gettimeofday/tm_unix.h b/src/utils/timer/gettimeofday/tm_unix.h
index 65c86b396..1b6c935a3 100644
--- a/src/utils/timer/gettimeofday/tm_unix.h
+++ b/src/utils/timer/gettimeofday/tm_unix.h
@@ -16,6 +16,7 @@ namespace Botan {
class BOTAN_DLL Unix_Timer : public Timer
{
public:
+ std::string name() const { return "Unix gettimeofday"; }
u64bit clock() const;
};
diff --git a/src/utils/timer/posix_rt/tm_posix.h b/src/utils/timer/posix_rt/tm_posix.h
index 7393646e1..0aee67abb 100644
--- a/src/utils/timer/posix_rt/tm_posix.h
+++ b/src/utils/timer/posix_rt/tm_posix.h
@@ -16,6 +16,7 @@ namespace Botan {
class BOTAN_DLL POSIX_Timer : public Timer
{
public:
+ std::string name() const { return "POSIX clock_gettime"; }
u64bit clock() const;
};
diff --git a/src/utils/timer/win32_query_perf_ctr/tm_win32.h b/src/utils/timer/win32_query_perf_ctr/tm_win32.h
index 09f30de4b..916bf2127 100644
--- a/src/utils/timer/win32_query_perf_ctr/tm_win32.h
+++ b/src/utils/timer/win32_query_perf_ctr/tm_win32.h
@@ -16,6 +16,7 @@ namespace Botan {
class BOTAN_DLL Win32_Timer : public Timer
{
public:
+ std::string name() const { return "Win32 QueryPerformanceCounter"; }
u64bit clock() const;
};