From 402424de9b4c7c8e0f42433061c1a1e88013218f Mon Sep 17 00:00:00 2001
From: Andreas <andreas.goransson@gmail.com>
Date: Fri, 12 May 2017 13:27:05 +0200
Subject: [PATCH] Fix incorrect include for mbedtls and version checking

---
 src/ssl.h | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

diff --git src/ssl.h src/ssl.h
index 3d40283..ab02a2d 100644
--- src/ssl.h
+++ 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)
-#include <mbedtls/ssl.h>
-#if (MBEDTLS_VERSION_MINOR > 3)
-#include <mbedtls/net_socket.h>
-#else
-#include <mbedtls/net.h>
-#endif
 #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
+
+#include <mbedtls/ssl.h>
+#if (MBEDTLS_VERSION_MINOR > 3)
+#include <mbedtls/net_sockets.h>
 #else
-#error mbedTLS version 2.0.0 or greater is required!
+#include <mbedtls/net.h>
 #endif
 
 #if defined(USE_MBEDTLS_HAVEGE)
