Compiling libcurl with mbedTLS 2.4.0 (compiled with MBEDTLS_DEPRECATED_REMOVED) fails #1087

Closed
wyattoday opened this Issue Oct 26, 2016 · 8 comments

Projects

None yet

3 participants

@wyattoday

I did this

We compiled the current version of mbedTLS (2.4.0) with "MBEDTLS_DEPRECATED_REMOVED", and we compiled libcurl to reference that library. Compilation of libcurl fails with:

vtls/mbedtls.c: In function ‘mbed_connect_step1’:
vtls/mbedtls.c:361: error: ‘mbedtls_net_send’ undeclared (first use in this function)
vtls/mbedtls.c:361: error: (Each undeclared identifier is reported only once
vtls/mbedtls.c:361: error: for each function it appears in.)
vtls/mbedtls.c:362: error: ‘mbedtls_net_recv’ undeclared (first use in this function)
make[2]: *** [vtls/libcurl_la-mbedtls.lo] Error 1

I expected the following

Successful compilation.

curl/libcurl version

7.50.3

operating system

Linux (CentOS 5)

Solution

In "lib/vtls/mbedtls.c" change the include from: "#include <mbedtls/net.h>" to "#include <mbedtls/net_sockets.h>"

@wyattoday wyattoday changed the title from Compiling libcurl with mbedTLS (compiled with MBEDTLS_DEPRECATED_REMOVED) fails to Compiling libcurl with mbedTLS 2.4.0 (compiled with MBEDTLS_DEPRECATED_REMOVED) fails Oct 26, 2016
@bagder bagder added a commit that closed this issue Oct 26, 2016
@bagder bagder mbedtls: stop using deprecated include file
Reported-by: wyattoday
Fixes #1087
62a8095
@bagder bagder closed this in 62a8095 Oct 26, 2016
@bagder
Member
bagder commented Oct 26, 2016

Thanks!

@tkelman
Contributor
tkelman commented Nov 4, 2016

I don't know where the minimum dependency versions for various configurations are documented (if anywhere), but it should be noted that this breaks compiling curl 7.51 against any version of mbedtls earlier than 2.4. Should this be made version-conditional?

@tkelman tkelman added a commit to JuliaLang/julia that referenced this issue Nov 4, 2016
@tkelman tkelman Upgrade curl to 7.51.0
Add a patch so curl builds against mbedtls pre-2.4, ref curl/curl#1087
59fa35c
@bagder
Member
bagder commented Nov 4, 2016 edited

Ugh. Well I call that a stupid decision by the mbedTLS people since they could just have made the old header name work.

Having it version-conditional sounds sensible, if we can figure out the mbedtls version before the included is made?

@tkelman
Contributor
tkelman commented Nov 4, 2016

2.4.0 was the first mbedtls release that included ARMmbed/mbedtls@3616f6f

@bagder
Member
bagder commented Nov 4, 2016

Like this?

diff --git a/lib/vtls/mbedtls.c b/lib/vtls/mbedtls.c
index 24249dd..9f29ff0 100644
--- a/lib/vtls/mbedtls.c
+++ b/lib/vtls/mbedtls.c
@@ -29,15 +29,19 @@

 #include "curl_setup.h"

 #ifdef USE_MBEDTLS

+#include <mbedtls/version.h>
+#if MBEDTLS_VERSION_NUMBER >= 0x02040000
 #include <mbedtls/net_sockets.h>
+#else
+#include <mbedtls/net.h>
+#endif
 #include <mbedtls/ssl.h>
 #include <mbedtls/certs.h>
 #include <mbedtls/x509.h>
-#include <mbedtls/version.h>

 #include <mbedtls/error.h>
 #include <mbedtls/entropy.h>
 #include <mbedtls/ctr_drbg.h>
 #include <mbedtls/sha256.h>
@tkelman
Contributor
tkelman commented Nov 4, 2016

Looks about right. Will test that and report back.

@tkelman tkelman added a commit to JuliaLang/julia that referenced this issue Nov 4, 2016
@tkelman tkelman Upgrade curl to 7.51.0
Add a patch so curl builds against mbedtls pre-2.4, ref curl/curl#1087
393aeab
@tkelman
Contributor
tkelman commented Nov 4, 2016

That's working so far, against mbedtls 2.3.0.

@bagder bagder added a commit that referenced this issue Nov 4, 2016
@bagder bagder mbedtls: fix build with mbedtls versions < 2.4.0
Regression added in 62a8095

Reported-by: Tony Kelman

Discussed in #1087
9ea3a6e
@bagder
Member
bagder commented Nov 4, 2016

Thanks!

@fcard fcard added a commit to fcard/julia that referenced this issue Feb 28, 2017
@tkelman @fcard tkelman + fcard Upgrade curl to 7.51.0
Add a patch so curl builds against mbedtls pre-2.4, ref curl/curl#1087
085135b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment