diff options
author | Philip Kaufmann <phil.kaufmann@t-online.de> | 2012-11-08 19:38:49 +0100 |
---|---|---|
committer | Philip Kaufmann <phil.kaufmann@t-online.de> | 2012-11-09 12:53:53 +0100 |
commit | 0f8a6477825fbaad0d37233bdd3011d748f607ab (patch) | |
tree | e4ef0256d9b5bccac47b3e9c901960d403bbdcbe /src/crypter.h | |
parent | 16d9d61f99c2e081585e6634d25da3523804eabf (diff) |
don't use memset() in privacy/security relevant code parts
As memset() can be optimized out by a compiler it should not be used in
privacy/security relevant code parts. OpenSSL provides the safe
OPENSSL_cleanse() function in crypto.h, which perfectly does the job of
clean and overwrite data.
For details see: http://www.viva64.com/en/b/0178/
- change memset() to OPENSSL_cleanse() where appropriate
- change a hard-coded number from netbase.cpp into a sizeof()
Diffstat (limited to 'src/crypter.h')
-rw-r--r-- | src/crypter.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/crypter.h b/src/crypter.h index 04538a3fa5..6f75170bac 100644 --- a/src/crypter.h +++ b/src/crypter.h @@ -76,8 +76,8 @@ public: void CleanKey() { - memset(&chKey, 0, sizeof chKey); - memset(&chIV, 0, sizeof chIV); + OPENSSL_cleanse(chKey, sizeof(chKey)); + OPENSSL_cleanse(chIV, sizeof(chIV)); fKeySet = false; } |