diff options
| author | Cory Fields <[email protected]> | 2015-01-20 19:23:25 -0500 |
|---|---|---|
| committer | Cory Fields <[email protected]> | 2015-02-15 11:34:02 -0500 |
| commit | 1630219d906f592c9258bfe2a0e0c4923df35782 (patch) | |
| tree | 02b0ed9574290873f88bd0ebc1bd0a224c98e5b1 /src/random.cpp | |
| parent | Merge #5629: [Qt] prevent amount overflow problem with payment requests (diff) | |
| download | discoin-1630219d906f592c9258bfe2a0e0c4923df35782.tar.xz discoin-1630219d906f592c9258bfe2a0e0c4923df35782.zip | |
openssl: abstract out OPENSSL_cleanse
This makes it easier for us to replace it if desired, since it's now only in
one spot. Also, it avoids the openssl include from allocators.h, which
essentially forced openssl to be included from every compilation unit.
Diffstat (limited to 'src/random.cpp')
| -rw-r--r-- | src/random.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/random.cpp b/src/random.cpp index 663456e96..ae25bee1b 100644 --- a/src/random.cpp +++ b/src/random.cpp @@ -5,6 +5,7 @@ #include "random.h" +#include "support/cleanse.h" #ifdef WIN32 #include "compat.h" // for Windows API #endif @@ -18,7 +19,6 @@ #include <sys/time.h> #endif -#include <openssl/crypto.h> #include <openssl/err.h> #include <openssl/rand.h> @@ -40,7 +40,7 @@ void RandAddSeed() // Seed with CPU performance counter int64_t nCounter = GetPerformanceCounter(); RAND_add(&nCounter, sizeof(nCounter), 1.5); - OPENSSL_cleanse((void*)&nCounter, sizeof(nCounter)); + memory_cleanse((void*)&nCounter, sizeof(nCounter)); } void RandAddSeedPerfmon() @@ -70,7 +70,7 @@ void RandAddSeedPerfmon() RegCloseKey(HKEY_PERFORMANCE_DATA); if (ret == ERROR_SUCCESS) { RAND_add(begin_ptr(vData), nSize, nSize / 100.0); - OPENSSL_cleanse(begin_ptr(vData), nSize); + memory_cleanse(begin_ptr(vData), nSize); LogPrint("rand", "%s: %lu bytes\n", __func__, nSize); } else { static bool warned = false; // Warn only once |