Fix incorrect include for mbedtls and version checking
authorAndreas <andreas.goransson@gmail.com>
Fri, 12 May 2017 11:27:05 +0000 (13:27 +0200)
committerGitHub <noreply@github.com>
Fri, 12 May 2017 11:27:05 +0000 (13:27 +0200)
src/ssl.h

index 3d402830142b3dcacf313910e571724527b38527..ab02a2d6e407c4f54f1d9773162607f41fdbd34f 100644 (file)
--- a/src/ssl.h
+++ b/src/ssl.h
@@ -89,20 +89,17 @@ int urandom_bytes(void *ctx, unsigned char *dest, size_t len);
 typedef        ssl_context SSL_handle_t;
 
 #elif defined(USE_MBEDTLS)
 typedef        ssl_context SSL_handle_t;
 
 #elif defined(USE_MBEDTLS)
-#include <mbedtls/ssl.h>
-#if (MBEDTLS_VERSION_MINOR > 3)
-#include <mbedtls/net_socket.h>
-#else
-#include <mbedtls/net.h>
-#endif
 #include <mbedtls/version.h>
 
 #include <mbedtls/version.h>
 
-#if defined(MBEDTLS_VERSION_MAJOR)
-#if (MBEDTLS_VERSION_MAJOR < 2)
+#if !defined(MBEDTLS_VERSION_MAJOR) || (MBEDTLS_VERSION_MAJOR < 2)
 #error mbedTLS version 2.0.0 or greater is required!
 #endif
 #error mbedTLS version 2.0.0 or greater is required!
 #endif
+
+#include <mbedtls/ssl.h>
+#if (MBEDTLS_VERSION_MINOR > 3)
+#include <mbedtls/net_sockets.h>
 #else
 #else
-#error mbedTLS version 2.0.0 or greater is required!
+#include <mbedtls/net.h>
 #endif
 
 #if defined(USE_MBEDTLS_HAVEGE)
 #endif
 
 #if defined(USE_MBEDTLS_HAVEGE)