Mbedtls on iOS/Android


I’m trying to compile mbedtls for use in a mobile program, and I cannot figure out how to configure it to cross-compile for ARM, nor can I find any documentation describing the process. There does not seem to be a clear way in the Makefile to do this. The website touts iOS and Android compatibility as a feature, so I believe it should be possible, but I have no clue where to start with it. I am working on a cross-platform app and am starting with the iOS bridge, but I will also need to compile it for use in Android as well, which would also require cross-compilation in ARM, and I would imagine it will require use of the iOS/Android NDK frameworks for standard library functionality.

Does anyone have an idea of how to do this or where to start looking for documentation?


Hi @BeStillAsBright
Thank you for your question!

The website doesn’t mention that the porting to IOS and Android is a feature in the delivery but it states:

mbed TLS is used on many architectures, including x86/x64, ARM, PowerPC, MIPS and Motorola 68000 and OS’es like Windows, Linuxes, Unixes, Apple iOS, FreeRTOS, ThreadX, Android OS, XBox, SEGGER embOS, OpenWRT, eCOS, VxWorks and much more.

This means that it can be ported to IOS and Android, but you will need to do the porting.
I suggest you look at https://tls.mbed.org/kb/how-to/how-do-i-port-mbed-tls-to-a-new-environment-OS to help you get started.

Mbed TLS can be built with cmake, in addition to gcc.
In order to build with a differnt toolchain, try buiding with a differe CC make parameter.
You can see examples for cross compilation in the all.sh script.
Mbed TLS Team member