Skip to content

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

Closed

Description

@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>"

Activity

  1. 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[/+] on Oct 26, 2016
  2. bagder commented on Oct 26, 2016

    @bagder
    Member

    Thanks!

  3. tkelman commented on Nov 4, 2016

    @tkelman
    Contributor

    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?

  4. added a commit that references this issue on Nov 4, 2016
  5. bagder commented on Nov 4, 2016

    @bagder
    Member

    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?

  6. tkelman commented on Nov 4, 2016

    @tkelman
    Contributor

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

  7. bagder commented on Nov 4, 2016

    @bagder
    Member

    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>
  8. tkelman commented on Nov 4, 2016

    @tkelman
    Contributor

    Looks about right. Will test that and report back.

  9. added a commit that references this issue on Nov 4, 2016
  10. tkelman commented on Nov 4, 2016

    @tkelman
    Contributor

    That's working so far, against mbedtls 2.3.0.

  11. bagder commented on Nov 4, 2016

    @bagder
    Member

    Thanks!

  12. added a commit that references this issue on Feb 28, 2017
  13. locked as resolved and limited conversation to collaborators on May 7, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions