mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-12-09 12:12:41 +01:00
wallet: Get rid of LockObject and UnlockObject calls in key.h
Replace these with vectors allocated from the secure allocator. This avoids mlock syscall churn on stack pages, as well as makes it possible to get rid of these functions. Please review this commit and the previous one carefully that no `sizeof(vectortype)` remains in the memcpys and memcmps usage (ick!), and `.data()` or `&vec[x]` is used as appropriate instead of &vec.
This commit is contained in:
@@ -157,21 +157,4 @@ private:
|
||||
static boost::once_flag init_flag;
|
||||
};
|
||||
|
||||
//
|
||||
// Functions for directly locking/unlocking memory objects.
|
||||
// Intended for non-dynamically allocated structures.
|
||||
//
|
||||
template <typename T>
|
||||
void LockObject(const T& t)
|
||||
{
|
||||
LockedPageManager::Instance().LockRange((void*)(&t), sizeof(T));
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
void UnlockObject(const T& t)
|
||||
{
|
||||
memory_cleanse((void*)(&t), sizeof(T));
|
||||
LockedPageManager::Instance().UnlockRange((void*)(&t), sizeof(T));
|
||||
}
|
||||
|
||||
#endif // BITCOIN_SUPPORT_PAGELOCKER_H
|
||||
|
||||
Reference in New Issue
Block a user