diff --git a/CMakeLists.txt b/CMakeLists.txt index 471a87916..1b07f0e75 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2226,6 +2226,10 @@ endif() CHECK_C_SOURCE_COMPILES("#define _GNU_SOURCE\n#include \nint main(void) {int fd[2];\n return pipe2(fd, 0);\n}\n" LWS_HAVE_PIPE2) +# old mbedtls has everything in mbedtls/net.h + +CHECK_C_SOURCE_COMPILES("#include \nint main(void) { return 0;}\n" LWS_HAVE_MBEDTLS_NET_SOCKETS) + # tcp keepalive needs this on linux to work practically... but it only exists # after kernel 2.6.37 diff --git a/cmake/lws_config.h.in b/cmake/lws_config.h.in index 56691a30e..ecfd8f4d2 100644 --- a/cmake/lws_config.h.in +++ b/cmake/lws_config.h.in @@ -53,6 +53,7 @@ #cmakedefine LWS_HAVE_mbedtls_ssl_set_hs_ca_chain #cmakedefine LWS_HAVE_mbedtls_ssl_set_hs_own_cert #cmakedefine LWS_HAVE_mbedtls_ssl_set_hs_authmode +#cmakedefine LWS_HAVE_MBEDTLS_NET_SOCKETS #cmakedefine LWS_HAVE_NEW_UV_VERSION_H #cmakedefine LWS_HAVE_OPENSSL_ECDH_H #cmakedefine LWS_HAVE_PIPE2 diff --git a/lib/tls/mbedtls/wrapper/platform/ssl_pm.c b/lib/tls/mbedtls/wrapper/platform/ssl_pm.c index 776abf57f..15f2b962f 100755 --- a/lib/tls/mbedtls/wrapper/platform/ssl_pm.c +++ b/lib/tls/mbedtls/wrapper/platform/ssl_pm.c @@ -18,7 +18,11 @@ /* mbedtls include */ #include "mbedtls/platform.h" +#if defined(LWS_HAVE_MBEDTLS_NET_SOCKETS) #include "mbedtls/net_sockets.h" +#else +#include "mbedtls/net.h" +#endif #include "mbedtls/debug.h" #include "mbedtls/entropy.h" #include "mbedtls/ctr_drbg.h"