aboutsummaryrefslogtreecommitdiff
path: root/src/crypto
diff options
context:
space:
mode:
authorRiccardo Spagni <ric@spagni.net>2017-12-16 23:19:27 +0200
committerRiccardo Spagni <ric@spagni.net>2017-12-16 23:19:27 +0200
commit6c0953b15a27a49403c6ec2a48c1b0dcefa1eda5 (patch)
tree90c341b746beeb252953081f75bef7f315704068 /src/crypto
parentMerge pull request #2856 (diff)
parentnew wipeable_string class to replace std::string passphrases (diff)
downloadmonero-6c0953b15a27a49403c6ec2a48c1b0dcefa1eda5.tar.xz
Merge pull request #2860
3dffe71b new wipeable_string class to replace std::string passphrases (moneromooo-monero) 7a2a5741 utils: initialize easylogging++ in on_startup (moneromooo-monero) 54950829 use memwipe in a few relevant places (moneromooo-monero) 000666ff add a memwipe function (moneromooo-monero)
Diffstat (limited to 'src/crypto')
-rw-r--r--src/crypto/chacha8.h5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/crypto/chacha8.h b/src/crypto/chacha8.h
index 80557e9f5..1bf695731 100644
--- a/src/crypto/chacha8.h
+++ b/src/crypto/chacha8.h
@@ -39,6 +39,7 @@
#if defined(__cplusplus)
#include <memory.h>
+#include "common/memwipe.h"
#include "hash.h"
namespace crypto {
@@ -54,7 +55,7 @@ namespace crypto {
~chacha8_key()
{
- memset(data, 0, sizeof(data));
+ memwipe(data, sizeof(data));
}
};
@@ -75,7 +76,7 @@ namespace crypto {
char pwd_hash[HASH_SIZE];
crypto::cn_slow_hash(data, size, pwd_hash);
memcpy(&key, pwd_hash, sizeof(key));
- memset(pwd_hash, 0, sizeof(pwd_hash));
+ memwipe(pwd_hash, sizeof(pwd_hash));
}
inline void generate_chacha8_key(std::string password, chacha8_key& key) {