| 65 | #endif |
| 66 | |
| 67 | static int thread_setup() |
| 68 | { |
| 69 | #if defined(USE_OPENSSL) && OPENSSL_VERSION_NUMBER < 0x10100000 |
| 70 | int i; |
| 71 | mutex_buf = (MUTEX_TYPE *)malloc(sizeof(MUTEX_TYPE) * CRYPTO_num_locks()); |
| 72 | |
| 73 | if (!mutex_buf) |
| 74 | return 0; |
| 75 | for (i = 0; i < CRYPTO_num_locks(); ++i) |
| 76 | MUTEX_SETUP(mutex_buf[i]); |
| 77 | |
| 78 | #ifndef WIN32 |
| 79 | /* For openssl>=1.0 it uses the address of errno for thread id. |
| 80 | * Works for us. */ |
| 81 | CRYPTO_set_id_callback(id_function); |
| 82 | #endif |
| 83 | |
| 84 | /* > All OpenSSL code has now been transferred to use the new |
| 85 | * > threading API, so the old one is no longer used and can be |
| 86 | * > removed. [...] There is now no longer a need to set locking |
| 87 | * > callbacks!! |
| 88 | * https://github.com/openssl/openssl/commit/ |
| 89 | * 2e52e7df518d80188c865ea3f7bb3526d14b0c08 */ |
| 90 | CRYPTO_set_locking_callback(locking_function); |
| 91 | #endif |
| 92 | return 1; |
| 93 | } |
| 94 | |
| 95 | static int passwd_call_back_routine(char *buf, int size, int /*flag*/, void *passwd) |
| 96 | { |