]> granicus.if.org Git - libevent/commitdiff
fix: compat mbedtls < 2.4
authorokhowang(王沛文) <okhowang@tencent.com>
Fri, 24 Jul 2020 09:19:14 +0000 (17:19 +0800)
committerokhowang(王沛文) <okhowang@tencent.com>
Fri, 24 Jul 2020 09:19:14 +0000 (17:19 +0800)
Makefile.am
bufferevent_mbedtls.c
mbedtls-compat.h [new file with mode: 0644]
sample/ssl-client-mbedtls.c

index 73e76b0b2e7b8c6e1a20533acfce0a567c7947b0..14a1ea68e4f78566a96b5c5ee2dd2f3e00ca12c5 100644 (file)
@@ -337,6 +337,7 @@ noinst_HEADERS +=                           \
        time-internal.h                         \
        util-internal.h                         \
        openssl-compat.h                        \
+       mbedtls-compat.h                        \
        ssl-compat.h                        \
        wepoll.h
 
index 1b59a5322590ac4096bf540b0125dfc1ec30da67..e188abed820f59addc9c90cec37427babdc9a7e9 100644 (file)
@@ -24,8 +24,8 @@
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+#include "mbedtls-compat.h"
 #include <mbedtls/ssl.h>
-#include <mbedtls/net_sockets.h>
 #include <mbedtls/error.h>
 
 #include "event2/util.h"
diff --git a/mbedtls-compat.h b/mbedtls-compat.h
new file mode 100644 (file)
index 0000000..34148e5
--- /dev/null
@@ -0,0 +1,11 @@
+#ifndef MBEDTLS_COMPAT_H
+#define MBEDTLS_COMPAT_H
+
+#include <mbedtls/version.h>
+#if MBEDTLS_VERSION_MAJOR < 2 || (MBEDTLS_VERSION_MAJOR == 2 && MBEDTLS_VERSION_MINOR < 4)
+#include <mbedtls/net.h>
+#else
+#include <mbedtls/net_sockets.h>
+#endif
+
+#endif // LIBEVENT_MBEDTLS_COMPAT_H
index 965913b2b8d4c166db81408b9c948969ef633e79..b63681d2c19a4c1b3bd5b5b7d9947abac94b8f3d 100644 (file)
@@ -22,7 +22,7 @@
 #include "mbedtls/config.h"
 #include "mbedtls/platform.h"
 
-#include "mbedtls/net_sockets.h"
+#include "mbedtls-compat.h"
 #include "mbedtls/debug.h"
 #include "mbedtls/ssl.h"
 #include "mbedtls/entropy.h"