AnsweredAssumed Answered

mbedtls FreeRTOS LPC54018 error no memory

Question asked by David Kaplan on May 31, 2020
Latest reply on Jun 3, 2020 by Felipe García

I have a working LPC54018 FreeRTOS project with AES256 encryption and an ECDL handshake. I have another non NXP board that works in the same way with mbedtls but not with FreeRTOS. I was using on the LPC54018 other code, instead of the mbedtls library but it did use IV initialization.  The mbedtls key functions are returning -16 which looks like MBEDTLS_ERR_MPI_ALLOC_FAILED. I am using RTOS configFRTOS_MEMORY_SCHEME 4 and have increased drastically the heap (configTOTAL_HEAP_SIZE ((size_t)(1024*100))) but nothing helps. I used MBEDTLS_CONFIG_FILE="ksdk_mbedtls_config.h" and also tried from a SDK example MBEDTLS_CONFIG_FILE='"azure_mbedtls_config.h"'. Is there some configuration parameter to lower memory usage or it may not be memory usage at all.


I first initialize mbedtls by calling the attached init_mbedtls() function and in my testing, I call my setupEcdhPeer() function to setup the keys I use. When calling mbedtls_ecdh_gen_public(), it returns -16 which looks like MBEDTLS_ERR_MPI_ALLOC_FAILED.


It maybe that I can remark mbedtls functionality that I do not need. I need AES256 SHA256 and the ECDL stuff.


Any help would be appreciated.