summaryrefslogtreecommitdiff
path: root/mbedtls-compat.h
diff options
context:
space:
mode:
authorWilliam Marlow <william.marlow@ibm.com>2022-06-23 23:06:14 +0100
committerAzat Khuzhin <azat@libevent.org>2022-07-09 20:47:04 +0300
commit384c52e6be5463e68662581dc94247fb40a18aa0 (patch)
tree7203512b8502c11674a90702a16360dee8b097a6 /mbedtls-compat.h
parent35e12a817530b665f508ebc832d944b7b0b2b63c (diff)
downloadlibevent-384c52e6be5463e68662581dc94247fb40a18aa0.tar.gz
Initial Mbed-TLS 3 support to get the GitHub Actions working again
mingw has upgraded to Mbed-TLS 3.1.0, so all the mingw tests that need Mbed-TLS currently don't work. v2: add missing mbedtls/version.h into test/regress_mbedtls.c v3: suppress #warning "Including compat-2.x.h is deprecated" for mbedtls/compat-2.x.h
Diffstat (limited to 'mbedtls-compat.h')
-rw-r--r--mbedtls-compat.h23
1 files changed, 21 insertions, 2 deletions
diff --git a/mbedtls-compat.h b/mbedtls-compat.h
index 34148e5b..b50ccd23 100644
--- a/mbedtls-compat.h
+++ b/mbedtls-compat.h
@@ -2,10 +2,29 @@
#define MBEDTLS_COMPAT_H
#include <mbedtls/version.h>
+
+#if MBEDTLS_VERSION_MAJOR >= 3
+# if defined(__clang__)
+# pragma clang diagnostic push
+# pragma clang diagnostic ignored "-Wcpp"
+# elif defined(__GNUC__)
+# pragma GCC diagnostic push
+# pragma GCC diagnostic ignored "-Wcpp"
+# endif
+
+# include <mbedtls/compat-2.x.h>
+
+# if defined(__clang__)
+# pragma clang diagnostic pop
+# elif defined(__GNUC__)
+# pragma GCC diagnostic pop
+# endif
+#endif // MBEDTLS_VERSION_MAJOR >= 3
+
#if MBEDTLS_VERSION_MAJOR < 2 || (MBEDTLS_VERSION_MAJOR == 2 && MBEDTLS_VERSION_MINOR < 4)
-#include <mbedtls/net.h>
+# include <mbedtls/net.h>
#else
-#include <mbedtls/net_sockets.h>
+# include <mbedtls/net_sockets.h>
#endif
#endif // LIBEVENT_MBEDTLS_COMPAT_H