fix(configs/mbedtls): patch Mbed TLS allocator to use app heap
The original Mbed TLS allocator uses a static variable as heap context
information. The library is used in apps, and each app should have its
own heap. This commit adds a patch to Mbed TLS so that the allocator
gets the heap context structure from the app heap area.
To make this work, the app heap area layout needs to be changed so that
the Mbed TLS heap context is the first. This is necessary so that any
app that uses the Mbed TLS allocator provides the heap context
structure on the same offset (0 in this case).
Change-Id: I4ca6a5882837f8fa9d9e9e2294eeec11808f2b2e
Signed-off-by: Mate Toth-Pal <mate.toth-pal@arm.com>
diff --git a/lib/mbedtls/CMakeLists.txt b/lib/mbedtls/CMakeLists.txt
index dbd4887..707757b 100644
--- a/lib/mbedtls/CMakeLists.txt
+++ b/lib/mbedtls/CMakeLists.txt
@@ -17,7 +17,8 @@
set(MBEDTLS_PATCH_DIR "${RMM_SOURCE_DIR}/configs/mbedtls")
set(MBEDTLS_PATCH_FILES
"${MBEDTLS_PATCH_DIR}/0001-Remove-compiler-options-for-clang.patch"
- "${MBEDTLS_PATCH_DIR}/0002-Disable-explicit_bzero.patch")
+ "${MBEDTLS_PATCH_DIR}/0002-Disable-explicit_bzero.patch"
+ "${MBEDTLS_PATCH_DIR}/0003-refactor-alloc-Use-the-heap-structure-provided-by-ap.patch")
Git_Apply_Patches(${MBEDTLS_SRC_DIR} "${MBEDTLS_PATCH_FILES}")