Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

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

Comments

@wyattoday
Copy link
Contributor

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 Compiling libcurl with mbedTLS (compiled with MBEDTLS_DEPRECATED_REMOVED) fails Compiling libcurl with mbedTLS 2.4.0 (compiled with MBEDTLS_DEPRECATED_REMOVED) fails Oct 26, 2016
@bagder bagder closed this as completed in 62a8095 Oct 26, 2016
@bagder
Copy link
Member

bagder commented Oct 26, 2016

Thanks!

@tkelman
Copy link
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 added a commit to JuliaLang/julia that referenced this issue Nov 4, 2016
Add a patch so curl builds against mbedtls pre-2.4, ref curl/curl#1087
@bagder
Copy link
Member

bagder commented Nov 4, 2016

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
Copy link
Contributor

tkelman commented Nov 4, 2016

2.4.0 was the first mbedtls release that included Mbed-TLS/mbedtls@3616f6f

@bagder
Copy link
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
Copy link
Contributor

tkelman commented Nov 4, 2016

Looks about right. Will test that and report back.

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

tkelman commented Nov 4, 2016

That's working so far, against mbedtls 2.3.0.

bagder added a commit that referenced this issue Nov 4, 2016
Regression added in 62a8095

Reported-by: Tony Kelman

Discussed in #1087
@bagder
Copy link
Member

bagder commented Nov 4, 2016

Thanks!

fcard pushed a commit to fcard/julia that referenced this issue Feb 28, 2017
Add a patch so curl builds against mbedtls pre-2.4, ref curl/curl#1087
@lock lock bot locked as resolved and limited conversation to collaborators May 7, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Development

No branches or pull requests

3 participants