Added OpenSSL Locking & Unlocking
#include <string>
#include <boost/thread/mutex.hpp>
#include <map>
+#include <openssl/crypto.h> // for OPENSSL_cleanse()
#ifdef WIN32
#ifdef _WIN32_WINNT
@@ -175,6 +176,19 @@ private:
{}
};
+//
+// 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) {
+ OPENSSL_cleanse((void*)(&t), sizeof(T));
+ LockedPageManager::instance.UnlockRange((void*)(&t), sizeof(T));
+}
+
//
// Allocator that locks its contents from being paged
// out of memory and clears its contents before deletion.
