aboutsummaryrefslogtreecommitdiff
path: root/src/random.cpp
diff options
context:
space:
mode:
authorPieter Wuille <pieter.wuille@gmail.com>2018-12-17 16:22:22 -0800
committerPieter Wuille <pieter.wuille@gmail.com>2019-01-16 16:34:56 -0800
commit4ea8e50837a0932b31a241988fd68d6730a2048a (patch)
tree03c43d9e325c5ce2bba307bc096c1626586121a2 /src/random.cpp
parent9d7032e4f066777c97c58b1394884716e213790a (diff)
Remove hwrand_initialized.
All access to hwrand is now gated by GetRNGState, which initializes the hwrand code.
Diffstat (limited to 'src/random.cpp')
-rw-r--r--src/random.cpp4
1 files changed, 0 insertions, 4 deletions
diff --git a/src/random.cpp b/src/random.cpp
index ca54cc9962..3f2465b2ed 100644
--- a/src/random.cpp
+++ b/src/random.cpp
@@ -76,7 +76,6 @@ static inline int64_t GetPerformanceCounter()
}
#if defined(__x86_64__) || defined(__amd64__) || defined(__i386__)
-static std::atomic<bool> hwrand_initialized{false};
static bool rdrand_supported = false;
static constexpr uint32_t CPUID_F1_ECX_RDRAND = 0x40000000;
static void InitHardwareRand()
@@ -85,12 +84,10 @@ static void InitHardwareRand()
if (__get_cpuid(1, &eax, &ebx, &ecx, &edx) && (ecx & CPUID_F1_ECX_RDRAND)) {
rdrand_supported = true;
}
- hwrand_initialized.store(true);
}
static void ReportHardwareRand()
{
- assert(hwrand_initialized.load(std::memory_order_relaxed));
if (rdrand_supported) {
// This must be done in a separate function, as HWRandInit() may be indirectly called
// from global constructors, before logging is initialized.
@@ -110,7 +107,6 @@ static void ReportHardwareRand() {}
static bool GetHardwareRand(unsigned char* ent32) {
#if defined(__x86_64__) || defined(__amd64__) || defined(__i386__)
- assert(hwrand_initialized.load(std::memory_order_relaxed));
if (rdrand_supported) {
uint8_t ok;
// Not all assemblers support the rdrand instruction, write it in hex.