1 /* 2 * Copyright (c) 2021 Espressif Systems (Shanghai) Co., Ltd. 3 * 4 * SPDX-License-Identifier: Apache-2.0 5 */ 6 7 #ifdef CONFIG_ESP_USE_MBEDTLS 8 9 #include <mbedtls/platform.h> 10 #include <mbedtls/memory_buffer_alloc.h> 11 12 #define CRYPTO_HEAP_SIZE 8192 13 14 static unsigned char memory_buf[CRYPTO_HEAP_SIZE]; 15 16 /* 17 * Initialize Mbed TLS to be able to use the local heap. 18 */ os_heap_init(void)19void os_heap_init(void) 20 { 21 mbedtls_memory_buffer_alloc_init(memory_buf, sizeof(memory_buf)); 22 } 23 #else 24 os_heap_init(void)25void os_heap_init(void) 26 { 27 } 28 29 #endif 30