summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Benjamin Barenblat <bbaren at mit.edu>2015-09-20 17:46:07 -0400
committerGravatar Benjamin Barenblat <bbaren at mit.edu>2015-09-20 17:46:07 -0400
commitdd5a19ce6d071c70e53db145b708ec9c102674f0 (patch)
tree37b337e60f9df517c895327003f41b83d717cf28 /src
parent5a087f2a1fa5024a11c1b614d78b303edcbf57c6 (diff)
Use correct OpenSSL thread safety macros on OS X (closes #209)
Create an Autoconf test to determine if pthread_t is a pointer or scalar type, and use the appropriate CRYPTO_THREADID_set macro based on the result.
Diffstat (limited to 'src')
-rw-r--r--src/c/openssl.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/c/openssl.c b/src/c/openssl.c
index 6d018707..206a3bc8 100644
--- a/src/c/openssl.c
+++ b/src/c/openssl.c
@@ -34,9 +34,15 @@ static void random_password() {
}
// OpenSSL callbacks
+#ifdef PTHREAD_T_IS_POINTER
+# define CRYPTO_THREADID_SET CRYPTO_THREADID_set_pointer
+#else
+# define CRYPTO_THREADID_SET CRYPTO_THREADID_set_numeric
+#endif
static void thread_id(CRYPTO_THREADID *const result) {
- CRYPTO_THREADID_set_numeric(result, pthread_self());
+ CRYPTO_THREADID_SET(result, pthread_self());
}
+#undef CRYPTO_THREADID_SET
static void lock_or_unlock(const int mode, const int type, const char *file,
const int line) {
pthread_mutex_t *const lock = &openssl_locks[type];