/// <summary> /// Cleanup this instance. /// </summary> public static void Cleanup() { // Cleanup the thread lock objects Native.CRYPTO_set_locking_callback(null); lock_objects.Clear(); // Clean up error state for each thread that was used by OpenSSL if (_threadIDs != null) { foreach (var id in _threadIDs) { RemoveState(id); } _threadIDs.Clear(); } }
/// <summary> /// Initialize this instance. /// </summary> public static void Initialize() { // Initialize the threading locks var nLocks = Native.CRYPTO_num_locks(); lock_objects = new List <object>(nLocks); for (var i = 0; i < nLocks; i++) { var obj = new object(); lock_objects.Add(obj); } // Initialize the internal thread id stack _threadIDs = new List <uint>(); // Initialize the delegate for the locking callback Native.CRYPTO_set_locking_callback(_ptrOnLocking); // Initialize the thread id callback Native.CRYPTO_THREADID_set_callback(_ptrOnThreadId); }