| 134 | } |
| 135 | |
| 136 | static void initCryptoLocks(void) { |
| 137 | unsigned i, nlocks; |
| 138 | if (CRYPTO_get_locking_callback() != NULL) { |
| 139 | /* Someone already set the callback before us. Don't destroy it! */ |
| 140 | return; |
| 141 | } |
| 142 | nlocks = CRYPTO_num_locks(); |
| 143 | openssl_locks = (pthread_mutex_t*)zmalloc(sizeof(*openssl_locks) * nlocks); |
| 144 | for (i = 0; i < nlocks; i++) { |
| 145 | pthread_mutex_init(openssl_locks + i, NULL); |
| 146 | } |
| 147 | CRYPTO_set_locking_callback(sslLockingCallback); |
| 148 | } |
| 149 | #endif /* USE_CRYPTO_LOCKS */ |
| 150 | |
| 151 | void tlsInit(void) { |