mbedtls: include correct net/net_sockets header according to version
PATCH 1/1 mbedtls: include correct net/net_sockets header according to version
<mbedtls/net.h> is deprecated as of mbedTLS 2.4.0, it is renamed <mbedtls/net_sockets.h>. OpenVPN will fail to build with mbedTLS 2.4.0 with MBEDTLS_DEPRECATED_REMOVED defined.
Check MBEDTLS_VERSION_NUMBER, and include net.h for < 2.4.0 and net_sockets.h for >= 2.4.0.
---
Tested, builing with both mbedTLS 2.3.0 and 2.4.0 with MBEDTLS_DEPRECATED_REMOVED is successful.
This patch is as much to document the issue as a suggested patch. I don't know if MBEDTLS_DEPRECATED_REMOVED is considered a distro/package maintainers problem or something to fix with an #if, so I won't be sad if it isn't accepted.
src/openvpn/ssl_mbedtls.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
src/openvpn/ssl_mbedtls.c +8 -2
@@ -51,11 +51,17 @@#include "ssl_verify_mbedtls.h" #include <mbedtls/debug.h> #include <mbedtls/error.h> -#include <mbedtls/net.h> +#include <mbedtls/version.h> + +#if MBEDTLS_VERSION_NUMBER >=0x02040000 +#include <mbedtls/net_sockets.h> +#else +#include <mbedtls/net.h> +#endif +#include <mbedtls/oid.h> #include <mbedtls/pem.h> #include <mbedtls/sha256.h> -#include <mbedtls/version.h> void tls_init_lib ()
Signature · 1 line
2.1.4
Hi,
Quoted 45 lines · Magnus Kroken
<
mbedtls/net.h> is deprecated as of mbedTLS 2.4.0, it is renamed <mbedtls/net_sockets.h>. OpenVPN will fail to build with mbedTLS 2.4.0 withMBEDTLS_DEPRECATED_REMOVEDdefined.Check
MBEDTLS_VERSION_NUMBER, and includenet.hfor < 2.4.0 andnet_sockets.hfor >= 2.4.0.Signed-off-by Magnus Kroken <[email protected]...>---
Tested, builing with both mbedTLS 2.3.0 and 2.4.0 withMBEDTLS_DEPRECATED_REMOVEDis successful.This patch is as much to document the issue as a suggested patch. I don't know if
MBEDTLS_DEPRECATED_REMOVEDis considered a distro/package maintainers problem or something to fix with an #if, so I won't be sad if it isn't accepted.src/openvpn/ssl_mbedtls.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)src/openvpn/ssl_mbedtls.c +8
-3@@ -51,11 +51,17 @@#include "ssl_verify_mbedtls.h" #include <mbedtls/debug.h> #include <mbedtls/error.h> -#include <mbedtls/net.h> +#include <mbedtls/version.h> + +#if MBEDTLS_VERSION_NUMBER >=0x02040000 +#include <mbedtls/net_sockets.h> +#else +#include <mbedtls/net.h> +#endif +#include <mbedtls/oid.h> #include <mbedtls/pem.h> #include <mbedtls/sha256.h> -#include <mbedtls/version.h> void tls_init_lib () --
Quoted 1 line
2.1.4
Looks good, passes tests. ACK.
We might remove the indenting of the preprocessor statements, but if not, this will be fixed soon by The Great Reformatting anyway.
-Steffan
Your patch has been applied to the master branch. Thanks.
I have not changed the #include formatting, as The Great Reformatting will catch it anyway.
commit c00919e8bd6a4e36d9fa009f3b1a93b262a59fc6
Author: Magnus Kroken Date: Fri Dec 9 10:07:35 2016 +0100
mbedtls: include correct net/net_sockets header according to version
Signed-off-by: Magnus Kroken <[email protected]...>
Acked-by: Steffan Karger <[email protected]...>
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg13451.html
Signed-off-by: Gert Doering <[email protected]...>--
kind regards,
Gert Doering