Lines 35-40
Link Here
|
35 |
|
35 |
|
36 |
namespace encfs { |
36 |
namespace encfs { |
37 |
|
37 |
|
|
|
38 |
#if OPENSSL_VERSION_NUMBER < 0x10100000L |
38 |
unsigned long pthreads_thread_id() { return (unsigned long)pthread_self(); } |
39 |
unsigned long pthreads_thread_id() { return (unsigned long)pthread_self(); } |
39 |
|
40 |
|
40 |
static pthread_mutex_t *crypto_locks = nullptr; |
41 |
static pthread_mutex_t *crypto_locks = nullptr; |
Lines 67-77
Link Here
|
67 |
crypto_locks = nullptr; |
68 |
crypto_locks = nullptr; |
68 |
} |
69 |
} |
69 |
} |
70 |
} |
|
|
71 |
#endif |
70 |
|
72 |
|
71 |
void openssl_init(bool threaded) { |
73 |
void openssl_init(bool threaded) { |
|
|
74 |
#if OPENSSL_VERSION_NUMBER < 0x10100000L |
72 |
// initialize the SSL library |
75 |
// initialize the SSL library |
73 |
SSL_load_error_strings(); |
76 |
SSL_load_error_strings(); |
74 |
SSL_library_init(); |
77 |
SSL_library_init(); |
|
|
78 |
#endif |
75 |
|
79 |
|
76 |
unsigned int randSeed = 0; |
80 |
unsigned int randSeed = 0; |
77 |
RAND_bytes((unsigned char *)&randSeed, sizeof(randSeed)); |
81 |
RAND_bytes((unsigned char *)&randSeed, sizeof(randSeed)); |
Lines 84-98
Link Here
|
84 |
ENGINE_register_all_complete(); |
88 |
ENGINE_register_all_complete(); |
85 |
#endif // NO_ENGINE |
89 |
#endif // NO_ENGINE |
86 |
|
90 |
|
|
|
91 |
#if OPENSSL_VERSION_NUMBER < 0x10100000L |
87 |
if (threaded) { |
92 |
if (threaded) { |
88 |
// provide locking functions to OpenSSL since we'll be running with |
93 |
// provide locking functions to OpenSSL since we'll be running with |
89 |
// threads accessing openssl in parallel. |
94 |
// threads accessing openssl in parallel. |
90 |
CRYPTO_set_id_callback(pthreads_thread_id); |
95 |
CRYPTO_set_id_callback(pthreads_thread_id); |
91 |
CRYPTO_set_locking_callback(pthreads_locking_callback); |
96 |
CRYPTO_set_locking_callback(pthreads_locking_callback); |
92 |
} |
97 |
} |
|
|
98 |
#endif |
93 |
} |
99 |
} |
94 |
|
100 |
|
95 |
void openssl_shutdown(bool threaded) { |
101 |
void openssl_shutdown(bool threaded) { |
|
|
102 |
#if OPENSSL_VERSION_NUMBER < 0x10100000L |
96 |
#ifndef OPENSSL_NO_ENGINE |
103 |
#ifndef OPENSSL_NO_ENGINE |
97 |
ENGINE_cleanup(); |
104 |
ENGINE_cleanup(); |
98 |
#endif |
105 |
#endif |
Lines 100-105
Link Here
|
100 |
if (threaded) { |
107 |
if (threaded) { |
101 |
pthreads_locking_cleanup(); |
108 |
pthreads_locking_cleanup(); |
102 |
} |
109 |
} |
|
|
110 |
#endif |
103 |
} |
111 |
} |
104 |
|
112 |
|
105 |
} // namespace encfs |
113 |
} // namespace encfs |