1 #if !defined(MBEDTLS_CONFIG_FILE)
2 #include "mbedtls/config.h"
3 #else
4 #include MBEDTLS_CONFIG_FILE
5 #endif
6 
7 #include <sys/types.h>
8 #include <stdlib.h>
9 #include <stdio.h>
10 #include <esp_system.h>
11 
12 #include "mbedtls/entropy_poll.h"
13 
14 #ifndef MBEDTLS_ENTROPY_HARDWARE_ALT
15 #error "MBEDTLS_ENTROPY_HARDWARE_ALT should always be set in ESP-IDF"
16 #endif
17 
mbedtls_hardware_poll(void * data,unsigned char * output,size_t len,size_t * olen)18 int mbedtls_hardware_poll( void *data,
19                            unsigned char *output, size_t len, size_t *olen )
20 {
21     esp_fill_random(output, len);
22     *olen = len;
23     return 0;
24 }
25