mirror of
https://github.com/monero-project/monero.git
synced 2025-11-30 15:06:48 -05:00
crypto: make secret_key automatically mlock
This commit is contained in:
parent
70271fa788
commit
ab74dc277a
5 changed files with 12 additions and 10 deletions
|
|
@ -103,7 +103,7 @@ namespace hw {
|
|||
bool device_default::generate_chacha_key(const cryptonote::account_keys &keys, crypto::chacha_key &key, uint64_t kdf_rounds) {
|
||||
const crypto::secret_key &view_key = keys.m_view_secret_key;
|
||||
const crypto::secret_key &spend_key = keys.m_spend_secret_key;
|
||||
tools::scrubbed_arr<char, sizeof(view_key) + sizeof(spend_key) + 1> data;
|
||||
epee::mlocked<tools::scrubbed_arr<char, sizeof(view_key) + sizeof(spend_key) + 1>> data;
|
||||
memcpy(data.data(), &view_key, sizeof(view_key));
|
||||
memcpy(data.data() + sizeof(view_key), &spend_key, sizeof(spend_key));
|
||||
data[sizeof(data) - 1] = CHACHA8_KEY_TAIL;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue