diff options
Diffstat (limited to 'src/random.cpp')
-rw-r--r-- | src/random.cpp | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/src/random.cpp b/src/random.cpp index 5f50c001cd..432592589a 100644 --- a/src/random.cpp +++ b/src/random.cpp @@ -8,23 +8,22 @@ #include <compat/cpuid.h> #include <crypto/sha256.h> #include <crypto/sha512.h> -#include <support/cleanse.h> -#ifdef WIN32 -#include <compat/compat.h> -#include <wincrypt.h> -#endif #include <logging.h> #include <randomenv.h> -#include <support/allocators/secure.h> #include <span.h> -#include <sync.h> // for Mutex -#include <util/time.h> // for GetTimeMicros() +#include <support/allocators/secure.h> +#include <support/cleanse.h> +#include <sync.h> +#include <util/time.h> #include <cmath> #include <cstdlib> #include <thread> -#ifndef WIN32 +#ifdef WIN32 +#include <windows.h> +#include <wincrypt.h> +#else #include <fcntl.h> #include <sys/time.h> #endif @@ -634,7 +633,7 @@ bool Random_SanityCheck() * GetOSRand() overwrites all 32 bytes of the output given a maximum * number of tries. */ - static const ssize_t MAX_TRIES = 1024; + static constexpr int MAX_TRIES{1024}; uint8_t data[NUM_OS_RANDOM_BYTES]; bool overwritten[NUM_OS_RANDOM_BYTES] = {}; /* Tracks which bytes have been overwritten at least once */ int num_overwritten; |