Commit e9771ef6 authored by David Brown's avatar David Brown Committed by David Brown
Browse files

Fix ECDSA Zephyr configuration of mbed TLS

The Zephyr configuration was enabling the memory buffer allocator (but
not using it) without defining enough other features to allow it to
compile (undefined reference to `exit()`).

Disable the memory buffer allocator when just using the ASN.1 library,
and conditionalize the heap itself to avoid using the RAM for that.

Signed-off-by: default avatarDavid Brown <david.brown@linaro.org>
parent da21ad73
Loading
Loading
Loading
Loading
−1
Changes for boot/zephyr/include/config-asn1.h: 0 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -31,7 +31,6 @@

#define MBEDTLS_PLATFORM_C
#define MBEDTLS_PLATFORM_MEMORY
#define MBEDTLS_MEMORY_BUFFER_ALLOC_C
#define MBEDTLS_PLATFORM_NO_STD_FUNCTIONS

/* mbed TLS modules */
+6
Changes for boot/zephyr/os.c: 6 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -26,6 +26,7 @@
#include <mbedtls/platform.h>
#include <mbedtls/memory_buffer_alloc.h>

#ifdef MCUBOOT_USE_MBED_TLS
/*
 * This is the heap for mbed TLS.  The value needed depends on the key
 * size and algorithm used.  For RSA-2048, 6144 bytes seems to be
@@ -42,3 +43,8 @@ void os_heap_init(void)
{
    mbedtls_memory_buffer_alloc_init(mempool, sizeof(mempool));
}
#else
void os_heap_init(void)
{
}
#endif