diff options
| author | Wladimir J. van der Laan <[email protected]> | 2015-02-19 12:00:17 +0100 |
|---|---|---|
| committer | Wladimir J. van der Laan <[email protected]> | 2015-02-19 12:09:26 +0100 |
| commit | 07f4386b387caddd82502d575cc9dba80b81d9f2 (patch) | |
| tree | 65727039c39354977ca8b9007ed9e395cb089586 /src/allocators.h | |
| parent | Merge #5803: Update debian changelog and control file (diff) | |
| parent | openssl: abstract out OPENSSL_cleanse (diff) | |
| download | discoin-07f4386b387caddd82502d575cc9dba80b81d9f2.tar.xz discoin-07f4386b387caddd82502d575cc9dba80b81d9f2.zip | |
Merge #5689: openssl: abstract out OPENSSL_cleanse
1630219 openssl: abstract out OPENSSL_cleanse (Cory Fields)
Diffstat (limited to 'src/allocators.h')
| -rw-r--r-- | src/allocators.h | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/allocators.h b/src/allocators.h index 6a131c351..8ffe015b9 100644 --- a/src/allocators.h +++ b/src/allocators.h @@ -6,6 +6,8 @@ #ifndef BITCOIN_ALLOCATORS_H #define BITCOIN_ALLOCATORS_H +#include "support/cleanse.h" + #include <map> #include <string> #include <string.h> @@ -14,8 +16,6 @@ #include <boost/thread/mutex.hpp> #include <boost/thread/once.hpp> -#include <openssl/crypto.h> // for OPENSSL_cleanse() - /** * Thread-safe class to keep track of locked (ie, non-swappable) memory pages. * @@ -174,7 +174,7 @@ void LockObject(const T& t) template <typename T> void UnlockObject(const T& t) { - OPENSSL_cleanse((void*)(&t), sizeof(T)); + memory_cleanse((void*)(&t), sizeof(T)); LockedPageManager::Instance().UnlockRange((void*)(&t), sizeof(T)); } @@ -217,7 +217,7 @@ struct secure_allocator : public std::allocator<T> { void deallocate(T* p, std::size_t n) { if (p != NULL) { - OPENSSL_cleanse(p, sizeof(T) * n); + memory_cleanse(p, sizeof(T) * n); LockedPageManager::Instance().UnlockRange(p, sizeof(T) * n); } std::allocator<T>::deallocate(p, n); @@ -254,7 +254,7 @@ struct zero_after_free_allocator : public std::allocator<T> { void deallocate(T* p, std::size_t n) { if (p != NULL) - OPENSSL_cleanse(p, sizeof(T) * n); + memory_cleanse(p, sizeof(T) * n); std::allocator<T>::deallocate(p, n); } }; |