]> granicus.if.org Git - curl/commitdiff
cyassl: Fix include order
authorJay Satiro <raysatiro@yahoo.com>
Fri, 17 Apr 2015 19:22:48 +0000 (15:22 -0400)
committerJay Satiro <raysatiro@yahoo.com>
Fri, 17 Apr 2015 19:24:04 +0000 (15:24 -0400)
Prior to this change CyaSSL's build options could redefine some generic
build symbols.

http://curl.haxx.se/mail/lib-2015-04/0069.html

lib/vtls/cyassl.c

index 24eca90709751c1fdf17bafbef13fb2d539a15c2..4d0a23f235eced9b6ee66b37d96974056d979653 100644 (file)
 
 #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
 #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