aboutsummaryrefslogtreecommitdiff
path: root/src/cryptonote_basic/account.cpp
diff options
context:
space:
mode:
authormoneromooo-monero <moneromooo-monero@users.noreply.github.com>2018-07-15 14:33:48 +0100
committermoneromooo-monero <moneromooo-monero@users.noreply.github.com>2018-08-16 11:57:49 +0000
commitab74dc277aac3922a266ccae30fa2c30d9222790 (patch)
tree5846c8cf7c865417039aa90540f330e950625ae6 /src/cryptonote_basic/account.cpp
parentcommon: add a class to safely wrap mlock/munlock (diff)
downloadmonero-ab74dc277aac3922a266ccae30fa2c30d9222790.tar.xz
crypto: make secret_key automatically mlock
Diffstat (limited to '')
-rw-r--r--src/cryptonote_basic/account.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/cryptonote_basic/account.cpp b/src/cryptonote_basic/account.cpp
index 0aebf9223..4cbfa8142 100644
--- a/src/cryptonote_basic/account.cpp
+++ b/src/cryptonote_basic/account.cpp
@@ -67,7 +67,7 @@ DISABLE_VS_WARNINGS(4244 4345)
static void derive_key(const crypto::chacha_key &base_key, crypto::chacha_key &key)
{
static_assert(sizeof(base_key) == sizeof(crypto::hash), "chacha key and hash should be the same size");
- tools::scrubbed_arr<char, sizeof(base_key)+1> data;
+ epee::mlocked<tools::scrubbed_arr<char, sizeof(base_key)+1>> data;
memcpy(data.data(), &base_key, sizeof(base_key));
data[sizeof(base_key)] = KEYS_ENCRYPTION_SALT;
crypto::generate_chacha_key(data.data(), sizeof(data), key, 1);
@@ -223,7 +223,7 @@ DISABLE_VS_WARNINGS(4244 4345)
void account_base::create_from_viewkey(const cryptonote::account_public_address& address, const crypto::secret_key& viewkey)
{
crypto::secret_key fake;
- memset(&unwrap(fake), 0, sizeof(fake));
+ memset(&unwrap(unwrap(fake)), 0, sizeof(fake));
create_from_keys(address, fake, viewkey);
}
//-----------------------------------------------------------------