summaryrefslogtreecommitdiffstats
path: root/crypto/async/async_locl.h
diff options
context:
space:
mode:
authorViktor Dukhovni <openssl-users@dukhovni.org>2015-11-21 20:14:43 -0500
committerViktor Dukhovni <openssl-users@dukhovni.org>2015-11-22 16:54:43 -0500
commit6e8ac5087061350a5a98ddc24dad6ceef9baf991 (patch)
tree35d5c7c7d42f03ccf97e67066b70a58e209667db /crypto/async/async_locl.h
parent3d32218812e87221344f2985512e42e4aaa88745 (diff)
Async error handling and MacOS/X fixes
In the async code for MacOS/X define _XOPEN_SOURCE (if not already defined) as early as possible. We must do this before including any header files, because on MacOS/X <stlib.h> includes <signal.h> which includes <ucontext.h>. If we delay defining _XOPEN_SOURCE and include <ucontext.h> after various system headers are included, we are very likely to end up with the wrong (truncated) definition of ucontext_t. Also, better error handling and some code cleanup in POSIX fibre construction and destruction. We make sure that async_fibre_makecontext() always initializes the fibre to a state that can be freed. For all implementations, check for error returns from async_fibre_makecontext(). Reviewed-by: Matt Caswell <matt@openssl.org>
Diffstat (limited to 'crypto/async/async_locl.h')
-rw-r--r--crypto/async/async_locl.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/crypto/async/async_locl.h b/crypto/async/async_locl.h
index a463bf1c22..ffb34f82e5 100644
--- a/crypto/async/async_locl.h
+++ b/crypto/async/async_locl.h
@@ -51,6 +51,15 @@
* ====================================================================
*/
+/*
+ * Must do this before including any header files, because on MacOS/X <stlib.h>
+ * includes <signal.h> which includes <ucontext.h>
+ */
+#if defined(__APPLE__) && defined(__MACH__) && !defined(_XOPEN_SOURCE)
+# define _XOPEN_SOURCE /* Otherwise incomplete ucontext_t structure */
+# pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+#endif
+
#include <openssl/async.h>
#include <openssl/crypto.h>