diff options
author | Jack Lloyd <[email protected]> | 2019-10-16 12:38:00 -0400 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2019-10-16 12:38:00 -0400 |
commit | d03deaa710324b101e1777622e2e4931918dfc2d (patch) | |
tree | 556e3217bc1ea3a996f3cd3b58663372bfaa9a2f /src/lib | |
parent | 16367f7468c9257f8eee2f5fcc26887e794bb6c7 (diff) | |
parent | b896677a8b6c22052908f70c393edc9ed50304e7 (diff) |
Merge GH #2158 Include high rest timestamp in RNG additional_data even if RDRAND is available
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/rng/stateful_rng/stateful_rng.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/lib/rng/stateful_rng/stateful_rng.cpp b/src/lib/rng/stateful_rng/stateful_rng.cpp index 80442542f..1587e50f8 100644 --- a/src/lib/rng/stateful_rng/stateful_rng.cpp +++ b/src/lib/rng/stateful_rng/stateful_rng.cpp @@ -44,17 +44,18 @@ void Stateful_RNG::randomize_with_ts_input(uint8_t output[], size_t output_len) { uint8_t additional_input[24] = { 0 }; + store_le(OS::get_high_resolution_clock(), additional_input); + #if defined(BOTAN_HAS_RDRAND_RNG) if(RDRAND_RNG::available()) { RDRAND_RNG rdrand; - rdrand.randomize(additional_input, sizeof(additional_input)); + rdrand.randomize(additional_input + 8, sizeof(additional_input) - 8); } else #endif { - store_le(OS::get_system_timestamp_ns(), additional_input); - store_le(OS::get_high_resolution_clock(), additional_input + 8); + store_le(OS::get_system_timestamp_ns(), additional_input + 8); store_le(m_last_pid, additional_input + 16); store_le(static_cast<uint32_t>(m_reseed_counter), additional_input + 20); } |