|
|
|
@ -17,9 +17,11 @@
@@ -17,9 +17,11 @@
|
|
|
|
|
|
|
|
|
|
#include <string> |
|
|
|
|
#include <vector> |
|
|
|
|
|
|
|
|
|
#include "bignum.h" |
|
|
|
|
#include "key.h" |
|
|
|
|
#include "script.h" |
|
|
|
|
#include "allocators.h" |
|
|
|
|
|
|
|
|
|
static const char* pszBase58 = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"; |
|
|
|
|
|
|
|
|
@ -178,7 +180,8 @@ protected:
@@ -178,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() |
|
|
|
|
{ |
|
|
|
@ -186,13 +189,6 @@ protected:
@@ -186,13 +189,6 @@ protected:
|
|
|
|
|
vchData.clear(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
~CBase58Data() |
|
|
|
|
{ |
|
|
|
|
// zero the memory, as it may contain sensitive data
|
|
|
|
|
if (!vchData.empty()) |
|
|
|
|
memset(&vchData[0], 0, vchData.size()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void SetData(int nVersionIn, const void* pdata, size_t nSize) |
|
|
|
|
{ |
|
|
|
|
nVersion = nVersionIn; |
|
|
|
@ -221,7 +217,7 @@ public:
@@ -221,7 +217,7 @@ public:
|
|
|
|
|
vchData.resize(vchTemp.size() - 1); |
|
|
|
|
if (!vchData.empty()) |
|
|
|
|
memcpy(&vchData[0], &vchTemp[1], vchData.size()); |
|
|
|
|
memset(&vchTemp[0], 0, vchTemp.size()); |
|
|
|
|
OPENSSL_cleanse(&vchTemp[0], vchData.size()); |
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -457,4 +453,4 @@ public:
@@ -457,4 +453,4 @@ public:
|
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
#endif |
|
|
|
|
#endif // BITCOIN_BASE58_H
|
|
|
|
|