What changes are required to mbedTLS APIs to use with LWIP

3.6k Views Asked by At

I want to add TLS support to my project. I am using mbedTLS and LWIP. As I am new to both, I want to know can I directly use the mbedTLS APIs as it is with LWIP or I will need some changes. What changes will be required for like bind, connect, send and receive APIs of the mbedTLS for LWIP compatibility. If any sample code for using both this is available then that can also do. Can anybody please help me with this?

Thanks in advance.

1

There are 1 best solutions below

1
On

mbedTLS explicitly mentions the LWIP stack on this page:
https://tls.mbed.org/kb/how-to/mbedtls-tutorial so I would guess that it should work without any problems.

The LwIP stack is highly configurable via the lwipopts.h header which you have to create to overwrite the default settings from include/lwip/opts.h.

For anything using "normal" sockets, you will have to enable the socket API of LWIP explicitly. Also it is wise to increase most of the conservative ressource settings of LwIP if you can on your device.

LwIP also has an OS abstraction layer that you might have to implement yourself, depending on your platform and I would guess that mbedTLS has something similar.