summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJay Satiro <raysatiro@yahoo.com>2015-04-17 15:22:48 -0400
committerJay Satiro <raysatiro@yahoo.com>2015-04-17 15:24:04 -0400
commitf70112522f2aad60c0c193721b828c88356a935c (patch)
tree96436ffdf4ed9a151e7c2b0c15c3d60b7d39d494
parent8dc3bbf0f8e201ff07dc1e50757d16004dc09d1e (diff)
downloadcurl-f70112522f2aad60c0c193721b828c88356a935c.tar.gz
cyassl: Fix include order
Prior to this change CyaSSL's build options could redefine some generic build symbols. http://curl.haxx.se/mail/lib-2015-04/0069.html
-rw-r--r--lib/vtls/cyassl.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/lib/vtls/cyassl.c b/lib/vtls/cyassl.c
index 24eca9070..4d0a23f23 100644
--- a/lib/vtls/cyassl.c
+++ b/lib/vtls/cyassl.c
@@ -30,6 +30,20 @@
#ifdef USE_CYASSL
+#define WOLFSSL_OPTIONS_IGNORE_SYS
+/* CyaSSL's version.h, which should contain only the version, should come
+before all other CyaSSL includes and be immediately followed by build config
+aka options.h. http://curl.haxx.se/mail/lib-2015-04/0069.html */
+#include <cyassl/version.h>
+#if defined(HAVE_CYASSL_OPTIONS_H) && (LIBCYASSL_VERSION_HEX > 0x03004008)
+#if defined(CYASSL_API) || defined(WOLFSSL_API)
+/* Safety measure. If either is defined some API include was already included
+and that's a problem since options.h hasn't been included yet. */
+#error "CyaSSL API was included before the CyaSSL build options."
+#endif
+#include <cyassl/options.h>
+#endif
+
#ifdef HAVE_LIMITS_H
#include <limits.h>
#endif
@@ -45,12 +59,7 @@
#include "rawstr.h"
#include "curl_printf.h"
-/* The first CyaSSL include should be its build config aka options.h */
-#ifdef HAVE_CYASSL_OPTIONS_H
-#include <cyassl/options.h>
-#endif
#include <cyassl/ssl.h>
-#include <cyassl/version.h>
#ifdef HAVE_CYASSL_ERROR_SSL_H
#include <cyassl/error-ssl.h>
#else