Index: tls.c ================================================================== --- tls.c +++ tls.c @@ -118,22 +118,19 @@ */ static Tcl_Mutex *locks = NULL; static Tcl_Mutex init_mx; -static void CryptoThreadLockCallback(int mode, int n, const char *file, int line); -static unsigned long CryptoThreadIdCallback(void); - -static void CryptoThreadLockCallback(int mode, int n, const char *file, int line) { +void CryptoThreadLockCallback(int mode, int n, const char *file, int line) { if (mode & CRYPTO_LOCK) { Tcl_MutexLock(&locks[n]); } else { Tcl_MutexUnlock(&locks[n]); } } -static unsigned long CryptoThreadIdCallback(void) { +unsigned long CryptoThreadIdCallback(void) { return (unsigned long) Tcl_GetCurrentThread(); } #endif /* OPENSSL_THREADS */ #endif /* TCL_THREADS */ @@ -1725,10 +1722,11 @@ return(TCL_OK); } dprintf("Asked to uninitialize"); + #if defined(OPENSSL_THREADS) && defined(TCL_THREADS) Tcl_MutexLock(&init_mx); CRYPTO_set_locking_callback(NULL); CRYPTO_set_id_callback(NULL); @@ -1752,15 +1750,16 @@ return(status); } dprintf("Called"); +#if defined(OPENSSL_THREADS) && defined(TCL_THREADS) + Tcl_MutexLock(&init_mx); +#endif initialized = 1; #if defined(OPENSSL_THREADS) && defined(TCL_THREADS) - Tcl_MutexLock(&init_mx); - num_locks = CRYPTO_num_locks(); locks = malloc(sizeof(*locks) * num_locks); CRYPTO_set_locking_callback(CryptoThreadLockCallback); CRYPTO_set_id_callback(CryptoThreadIdCallback);