Merge pull request #113 from Trivve/patch-2
authorFelix Morgner <felix.morgner@gmail.com>
Thu, 18 May 2017 11:11:03 +0000 (13:11 +0200)
committerGitHub <noreply@github.com>
Thu, 18 May 2017 11:11:03 +0000 (13:11 +0200)
Fix error compiling with mbed TLS 2.4

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)
-#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)