aboutsummaryrefslogtreecommitdiffstats
path: root/src/rng
diff options
context:
space:
mode:
authorlloyd <[email protected]>2013-11-09 16:22:30 +0000
committerlloyd <[email protected]>2013-11-09 16:22:30 +0000
commitad9b75f7211bcc5f6c4e9d49cce3e6f61431b593 (patch)
tree76e30a18cd402fcfb52798303512b80cd03541e0 /src/rng
parent350ff990289a2f64257c7deb509dbc0130905ae9 (diff)
Include a timestamp as part of the HMAC_RNG PRF inputs
Diffstat (limited to 'src/rng')
-rw-r--r--src/rng/hmac_rng/hmac_rng.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/rng/hmac_rng/hmac_rng.cpp b/src/rng/hmac_rng/hmac_rng.cpp
index 2984e238b..0f6a15a0b 100644
--- a/src/rng/hmac_rng/hmac_rng.cpp
+++ b/src/rng/hmac_rng/hmac_rng.cpp
@@ -11,6 +11,7 @@
#include <botan/entropy_src.h>
#include <botan/internal/xor_buf.h>
#include <algorithm>
+#include <chrono>
namespace Botan {
@@ -21,8 +22,13 @@ void hmac_prf(MessageAuthenticationCode& prf,
u32bit& counter,
const std::string& label)
{
+ typedef std::chrono::high_resolution_clock clock;
+
+ auto timestamp = clock::now().time_since_epoch().count();
+
prf.update(K);
prf.update(label);
+ prf.update_be(timestamp);
prf.update_be(counter);
prf.final(&K[0]);