crypto: make secret_key automatically mlock

This commit is contained in:
moneromooo-monero
2018-07-15 14:33:48 +01:00
parent 70271fa788
commit ab74dc277a
5 changed files with 12 additions and 10 deletions
+1 -1
View File
@@ -2963,7 +2963,7 @@ void wallet2::setup_keys(const epee::wipeable_string &password)
}
static_assert(HASH_SIZE == sizeof(crypto::chacha_key), "Mismatched sizes of hash and chacha key");
tools::scrubbed_arr<char, HASH_SIZE+1> cache_key_data;
epee::mlocked<tools::scrubbed_arr<char, HASH_SIZE+1>> cache_key_data;
memcpy(cache_key_data.data(), &key, HASH_SIZE);
cache_key_data[HASH_SIZE] = CACHE_KEY_TAIL;
cn_fast_hash(cache_key_data.data(), HASH_SIZE+1, (crypto::hash&)m_cache_key);