Mbed TLS is now part of TrustedFirmware.org.

resource usage on ARM Cortex M4

Apr 13, 2018 22:34
Stephen Wolfe

I'm trying to use mbed tls to perform some crypto operations on a cortex M4. I don't need a full TLS stack, I only need a couple public key crypt algorithms (RSA-PSS and DH with 2K-3K bit keys).

I have built the mbed crypto library for bare metal CM4, and I have linked it into a small program that does a diffie-hellman exchange. However, I am finding that the binary is over 100KB which is really large in respect to the amount of free memory on my device.

Is a 100KB binary expected for a simple program that performs a DH key exchange? Also, will the entire 100 KB binary get loaded into RAM at once? Or, will only a portion of this get loaded into RAM?

Apr 15, 2018 08:49
Ron Eldor

Hi Stephen,
It seems that you haven't configured out all the modules you don't need in your application.
In addition, the binary size of your application is not necessary your code size. You should strip all debug symbols, etc..
i believe the following articles may assist you:

If all you need is Diffie-Helmann , you should probably only need to enable MBEDTLS_DHM_C or MBEDTLS_ECDH_C and their prerequisites. You will probably need to enable some other platform related definitions.
Mbed TLS Team member

Apr 16, 2018 18:03

I use MbedTLS on STM32L476 and STM32L151RET6. Code size is 94K with my code 21K. RAM usage less 80K. I split tansmit buffer (512B) and recieve buffer(8K).

Both variant work sucsess with ciphersuite is TLS-DHE-RSA-WITH-AES-256-GCM-SHA384.