espidf 5.3 mbedtls removed function (mbedtls_pk_load_file)?

fschuetz
Posts: 9
Joined: Thu Sep 17, 2020 10:37 pm

espidf 5.3 mbedtls removed function (mbedtls_pk_load_file)?

Postby fschuetz » Sun Aug 04, 2024 11:51 am

In espidf 5.0.1 the TLS implementation of espidf provided the function int mbedtls_pk_load_file(const char path, unsigned char **buf, size_tn). It seems, this function seems no longer present in the newest version of the framework. I could not find any changelog for that and which function it is substituted by.
What new function should be used? I ported libssh2 in one of my projects and libssh2 uses this function. I would need to know how to adapt this.

ESP_harshal
Posts: 24
Joined: Wed Jul 06, 2022 8:36 am

Re: espidf 5.3 mbedtls removed function (mbedtls_pk_load_file)?

Postby ESP_harshal » Tue Aug 06, 2024 3:49 am

Hi @fschuetz,

A similar issue has been reported in the mbedtls issues as well, could you please take a look into this thread https://github.com/libssh2/libssh2/comm ... -141379351.

I think the crux of the above discussion is that the

Code: Select all

 mbedtls_pk_load_file()
was always a private function but they had misplaced it in the public header, so they seem to now suggest using

Code: Select all

mbedtls_pk_parse_key()
.

Thank you!

fschuetz
Posts: 9
Joined: Thu Sep 17, 2020 10:37 pm

Re: espidf 5.3 mbedtls removed function (mbedtls_pk_load_file)?

Postby fschuetz » Thu Aug 08, 2024 9:49 am

Thanks you very much for pointing in this direction. This is exactly the problem. I currently fixed it the same way as the libssh2 project just did: Force exposing the function in the mbedtls.c file of libssh2:

Code: Select all

/* Force-expose internal mbedTLS function */
#if MBEDTLS_VERSION_NUMBER >= 0x03060000
int mbedtls_pk_load_file(const char *path, unsigned char **buf, size_t *n);
#endif
Ugly but it works. I might look into how to properly implement the function and offer the solution to libssh2, if they are not faster.

Who is online

Users browsing this forum: No registered users and 83 guests