2021-10-29 00:39:53 -04:00
|
|
|
/*
|
|
|
|
* SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
|
|
*/
|
2021-05-28 09:13:32 -04:00
|
|
|
#include <mbedtls/build_info.h>
|
2016-08-30 08:40:58 -04:00
|
|
|
|
|
|
|
#include <sys/types.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <stdio.h>
|
2022-01-12 01:53:47 -05:00
|
|
|
#include "esp_random.h"
|
2016-09-01 23:31:38 -04:00
|
|
|
|
2021-05-09 23:43:44 -04:00
|
|
|
#include <entropy_poll.h>
|
2018-11-11 02:44:54 -05:00
|
|
|
|
2018-08-15 04:20:16 -04:00
|
|
|
#ifndef MBEDTLS_ENTROPY_HARDWARE_ALT
|
|
|
|
#error "MBEDTLS_ENTROPY_HARDWARE_ALT should always be set in ESP-IDF"
|
|
|
|
#endif
|
2016-08-30 08:40:58 -04:00
|
|
|
|
|
|
|
int mbedtls_hardware_poll( void *data,
|
|
|
|
unsigned char *output, size_t len, size_t *olen )
|
|
|
|
{
|
2018-08-15 04:20:16 -04:00
|
|
|
esp_fill_random(output, len);
|
2016-09-01 23:31:38 -04:00
|
|
|
*olen = len;
|
|
|
|
return 0;
|
2016-08-30 08:40:58 -04:00
|
|
|
}
|