diff options
author | Philip Kaufmann <phil.kaufmann@t-online.de> | 2012-11-09 12:50:59 +0100 |
---|---|---|
committer | Philip Kaufmann <phil.kaufmann@t-online.de> | 2012-11-09 19:25:20 +0100 |
commit | d0b0925be9f94068deb98940103a7b8a8c56f027 (patch) | |
tree | 7b70b1b67420fca905bfea179599954d0bad5ca8 /src/base58.h | |
parent | 0f8a6477825fbaad0d37233bdd3011d748f607ab (diff) |
make CBase58Data class use zero_after_free_allocator
- this way there is no need for an explicit destructor, who does the same
thing anyway
Diffstat (limited to 'src/base58.h')
-rw-r--r-- | src/base58.h | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/src/base58.h b/src/base58.h index 309d35f5d9..be8a541f67 100644 --- a/src/base58.h +++ b/src/base58.h @@ -17,11 +17,11 @@ #include <string> #include <vector> -#include <openssl/crypto.h> // for OPENSSL_cleanse() #include "bignum.h" #include "key.h" #include "script.h" +#include "allocators.h" static const char* pszBase58 = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"; @@ -180,7 +180,8 @@ protected: unsigned char nVersion; // the actually encoded data - std::vector<unsigned char> vchData; + typedef std::vector<unsigned char, zero_after_free_allocator<unsigned char> > vector_uchar; + vector_uchar vchData; CBase58Data() { @@ -188,13 +189,6 @@ protected: vchData.clear(); } - ~CBase58Data() - { - // zero the memory, as it may contain sensitive data - if (!vchData.empty()) - OPENSSL_cleanse(&vchData[0], vchData.size()); - } - void SetData(int nVersionIn, const void* pdata, size_t nSize) { nVersion = nVersionIn; @@ -459,4 +453,4 @@ public: } }; -#endif +#endif // BITCOIN_BASE58_H |