1 /*
2  * SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 #include <mbedtls/build_info.h>
7 
8 #include <sys/types.h>
9 #include <stdlib.h>
10 #include <stdio.h>
11 #include "esp_random.h"
12 
13 #include <entropy_poll.h>
14 
15 #ifndef MBEDTLS_ENTROPY_HARDWARE_ALT
16 #error "MBEDTLS_ENTROPY_HARDWARE_ALT should always be set in ESP-IDF"
17 #endif
18 
mbedtls_hardware_poll(void * data,unsigned char * output,size_t len,size_t * olen)19 int mbedtls_hardware_poll( void *data,
20                            unsigned char *output, size_t len, size_t *olen )
21 {
22     esp_fill_random(output, len);
23     *olen = len;
24     return 0;
25 }
26