Skip to content

Commit

Permalink
Replace memset by OPENSSL_cleanse
Browse files Browse the repository at this point in the history
in some areas where clearing memory is critical.
  • Loading branch information
sats0k committed Sep 23, 2021
1 parent ba36703 commit 8b02775
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/base58.h
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ class CBase58Data {
~CBase58Data() {
// zero the memory, as it may contain sensitive data
if(!vchData.empty())
memset(&vchData[0], 0, vchData.size());
OPENSSL_cleanse(&vchData[0], vchData.size());
}

void SetData(int nVersionIn, const void* pdata, size_t nSize) {
Expand Down
2 changes: 1 addition & 1 deletion src/util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ instance_of_cinit;
void RandAddSeed() {
int64 nCounter = GetTimeMicros();
RAND_add(&nCounter, sizeof(nCounter), 1.5);
memset(&nCounter, 0, sizeof(nCounter));
OPENSSL_cleanse(&nCounter, sizeof(nCounter));
}

void RandAddSeedPerfmon()
Expand Down

0 comments on commit 8b02775

Please sign in to comment.