diff options
author | lloyd <[email protected]> | 2013-11-09 16:22:30 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2013-11-09 16:22:30 +0000 |
commit | ad9b75f7211bcc5f6c4e9d49cce3e6f61431b593 (patch) | |
tree | 76e30a18cd402fcfb52798303512b80cd03541e0 /src/rng | |
parent | 350ff990289a2f64257c7deb509dbc0130905ae9 (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.cpp | 6 |
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]); |