summaryrefslogtreecommitdiff
path: root/drivers/auth
diff options
context:
space:
mode:
authorRoberto Vargas <roberto.vargas@arm.com>2018-05-24 13:34:53 +0100
committerRoberto Vargas <roberto.vargas@arm.com>2018-08-03 11:31:39 +0100
commit6c3733456706809d5c9fb78a9746bf2fa484fb91 (patch)
tree33db63840f53e4d26ed3934be84e91f041b6eead /drivers/auth
parentea7a57a3a5963a5c8a67bfd42b4f6ad1472b46f3 (diff)
Add atexit function to libc
We had exit but we didn't have atexit, and we were calling panic and tf_printf from exit, which generated a dependency from exit to them. Having atexit allows to set a different function pointer in every image. Change-Id: I95b9556d680d96249ed3b14da159b6f417da7661 Signed-off-by: Roberto Vargas <roberto.vargas@arm.com>
Diffstat (limited to 'drivers/auth')
-rw-r--r--drivers/auth/mbedtls/mbedtls_common.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/drivers/auth/mbedtls/mbedtls_common.c b/drivers/auth/mbedtls/mbedtls_common.c
index c048d005..64dc1967 100644
--- a/drivers/auth/mbedtls/mbedtls_common.c
+++ b/drivers/auth/mbedtls/mbedtls_common.c
@@ -5,6 +5,7 @@
*/
#include <debug.h>
+#include <stdlib.h>
/* mbed TLS headers */
#include <mbedtls/memory_buffer_alloc.h>
@@ -23,6 +24,12 @@
#endif
static unsigned char heap[MBEDTLS_HEAP_SIZE];
+static void cleanup(void)
+{
+ ERROR("EXIT from BL2\n");
+ panic();
+}
+
/*
* mbed TLS initialization function
*/
@@ -31,6 +38,9 @@ void mbedtls_init(void)
static int ready;
if (!ready) {
+ if (atexit(cleanup))
+ panic();
+
/* Initialize the mbed TLS heap */
mbedtls_memory_buffer_alloc_init(heap, MBEDTLS_HEAP_SIZE);