From f70112522f2aad60c0c193721b828c88356a935c Mon Sep 17 00:00:00 2001 From: Jay Satiro Date: Fri, 17 Apr 2015 15:22:48 -0400 Subject: 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 --- lib/vtls/cyassl.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) (limited to 'lib/vtls') 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 +#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 +#endif + #ifdef HAVE_LIMITS_H #include #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 -#endif #include -#include #ifdef HAVE_CYASSL_ERROR_SSL_H #include #else -- cgit v1.2.3