Almir Okato | eb6b7bf | 2021-09-07 17:06:35 -0300 | [diff] [blame] | 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 | |
Gustavo Henrique Nihei | a349510 | 2021-12-09 15:47:50 -0300 | [diff] [blame^] | 12 | #define CRYPTO_HEAP_SIZE 8192 |
Almir Okato | eb6b7bf | 2021-09-07 17:06:35 -0300 | [diff] [blame] | 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 | */ |
| 19 | void os_heap_init(void) |
| 20 | { |
| 21 | mbedtls_memory_buffer_alloc_init(memory_buf, sizeof(memory_buf)); |
| 22 | } |
| 23 | #else |
| 24 | |
| 25 | void os_heap_init(void) |
| 26 | { |
| 27 | } |
| 28 | |
| 29 | #endif |