Overview
Comment: | Updated to properly sanitize memory needed for the dynamically allocated locks |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | wip-fix-io-layer |
Files: | files | file ages | folders |
SHA1: |
f73f94ae3501c8367e7556fa2a3427af |
User & Date: | rkeene on 2016-12-13 05:11:15 |
Other Links: | branch diff | manifest | tags |
Context
2016-12-13
| ||
05:12 | Merged in work for the I/O layer being updated check-in: 2f45dac5f7 user: rkeene tags: trunk | |
05:11 | Updated to properly sanitize memory needed for the dynamically allocated locks Closed-Leaf check-in: f73f94ae35 user: rkeene tags: wip-fix-io-layer | |
04:50 | Updated to not declare variables for checking for fastpath unless fastpath is being compiled in check-in: 0a5d288053 user: rkeene tags: wip-fix-io-layer | |
Changes
Modified tls.c
from [f6e2948561]
to [8eeae8c00a].
︙ | ︙ | |||
114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 | /* * Threaded operation requires locking callbacks * Based from /crypto/cryptlib.c of OpenSSL and NSOpenSSL. */ static Tcl_Mutex *locks = NULL; static Tcl_Mutex init_mx; void CryptoThreadLockCallback(int mode, int n, const char *file, int line) { if (mode & CRYPTO_LOCK) { Tcl_MutexLock(&locks[n]); } else { Tcl_MutexUnlock(&locks[n]); } return; file = file; line = line; } unsigned long CryptoThreadIdCallback(void) { | > > > > > > > > > > > > | > > > > | 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 | /* * Threaded operation requires locking callbacks * Based from /crypto/cryptlib.c of OpenSSL and NSOpenSSL. */ static Tcl_Mutex *locks = NULL; static int locksCount = 0; static Tcl_Mutex init_mx; void CryptoThreadLockCallback(int mode, int n, const char *file, int line) { if (mode & CRYPTO_LOCK) { /* This debugging is turned off by default -- it's too noisy. */ /* dprintf("Called to lock (n=%i of %i)", n, locksCount); */ Tcl_MutexLock(&locks[n]); } else { /* dprintf("Called to unlock (n=%i of %i)", n, locksCount); */ Tcl_MutexUnlock(&locks[n]); } dprintf("Returning"); return; file = file; line = line; } unsigned long CryptoThreadIdCallback(void) { unsigned long ret; dprintf("Called"); ret = (unsigned long) Tcl_GetCurrentThread(); dprintf("Returning %lu", ret); return(ret); } #endif /* OPENSSL_THREADS */ #endif /* TCL_THREADS */ /* *------------------------------------------------------------------- |
︙ | ︙ | |||
1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 | CRYPTO_set_locking_callback(NULL); CRYPTO_set_id_callback(NULL); if (locks) { free(locks); locks = NULL; } #endif initialized = 0; #if defined(OPENSSL_THREADS) && defined(TCL_THREADS) Tcl_MutexUnlock(&init_mx); #endif | > | 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 | CRYPTO_set_locking_callback(NULL); CRYPTO_set_id_callback(NULL); if (locks) { free(locks); locks = NULL; locksCount = 0; } #endif initialized = 0; #if defined(OPENSSL_THREADS) && defined(TCL_THREADS) Tcl_MutexUnlock(&init_mx); #endif |
︙ | ︙ | |||
1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 | #if defined(OPENSSL_THREADS) && defined(TCL_THREADS) Tcl_MutexLock(&init_mx); #endif initialized = 1; #if defined(OPENSSL_THREADS) && defined(TCL_THREADS) num_locks = CRYPTO_num_locks(); locks = malloc(sizeof(*locks) * num_locks); CRYPTO_set_locking_callback(CryptoThreadLockCallback); CRYPTO_set_id_callback(CryptoThreadIdCallback); #endif if (SSL_library_init() != 1) { status = TCL_ERROR; | > > | 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 | #if defined(OPENSSL_THREADS) && defined(TCL_THREADS) Tcl_MutexLock(&init_mx); #endif initialized = 1; #if defined(OPENSSL_THREADS) && defined(TCL_THREADS) num_locks = CRYPTO_num_locks(); locksCount = num_locks; locks = malloc(sizeof(*locks) * num_locks); memset(locks, 0, sizeof(*locks) * num_locks); CRYPTO_set_locking_callback(CryptoThreadLockCallback); CRYPTO_set_id_callback(CryptoThreadIdCallback); #endif if (SSL_library_init() != 1) { status = TCL_ERROR; |
︙ | ︙ |