diff options
author | Pieter Wuille <pieter.wuille@gmail.com> | 2019-01-10 18:34:17 -0800 |
---|---|---|
committer | Pieter Wuille <pieter.wuille@gmail.com> | 2019-01-16 16:34:57 -0800 |
commit | f2e60ca98530e0a865ff6c6fd3c5633aec11a515 (patch) | |
tree | dbed713723856c2e75ebcb08b6287fad7cdf04d2 /src | |
parent | cddb31bb0a132afa50b5350196cf26f0064fe3e2 (diff) |
Use secure allocator for RNG state
Diffstat (limited to 'src')
-rw-r--r-- | src/random.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/random.cpp b/src/random.cpp index fe5341ba5f..4cd6c9ddc1 100644 --- a/src/random.cpp +++ b/src/random.cpp @@ -19,6 +19,8 @@ #include <chrono> #include <thread> +#include <support/allocators/secure.h> + #ifndef WIN32 #include <fcntl.h> #include <sys/time.h> @@ -351,8 +353,8 @@ RNGState& GetRNGState() noexcept { // This C++11 idiom relies on the guarantee that static variable are initialized // on first call, even when multiple parallel calls are permitted. - static std::unique_ptr<RNGState> g_rng{new RNGState()}; - return *g_rng; + static std::vector<RNGState, secure_allocator<RNGState>> g_rng(1); + return g_rng[0]; } } |