Arm Mbed and Pelion Device Management support forum

How to import mbedtls in LWIP

I am using Modbus TCP with the lwip without TLS. But I want to use TLS , how can i import TLS in Lwip ?

Hi Duygu,

Basically, you need to register the network send/recv function by mbedtls_ssl_set_bio, please refer to this porting guide for further information.

Regards,
Desmond

Hi Desmon,
Thank you for your reply. I am using stm32f4 and cubemx. Cubemx has lwip and mbedtls middlewares. I added them to my source code. Should I change my codes ? When I receive something, I use mbedtls_ssl_set_bio() this function. Is it true or not?

Hi @duyci

Should I change my codes ? When I receive something, I use mbedtls_ssl_set_bio() this function. Is it true or not?

mbedtls_ssl_set_bio() should be called once when you configure your Mbed TLS peer. It is used to set your own send \ recv callbacks that are called within the Mbed TLS library. You don’t need to call this function every time you receive something. You only need to implement wrapper functions for the send\recv callbacks, calling the lwip API.
Regards,
Mbed TLS Support
Ron