Page 1 of 1

espidf 5.3 mbedtls removed function (mbedtls_pk_load_file)?

Posted: Sun Aug 04, 2024 11:51 am
by fschuetz
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.

Re: espidf 5.3 mbedtls removed function (mbedtls_pk_load_file)?

Posted: Tue Aug 06, 2024 3:49 am
by ESP_harshal
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!

Re: espidf 5.3 mbedtls removed function (mbedtls_pk_load_file)?

Posted: Thu Aug 08, 2024 9:49 am
by fschuetz
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.