83a179abb0
Convenience function to fill a buffer with random bytes. Add some unit tests (only sanity checks, really.)
24 lines
494 B
C
24 lines
494 B
C
#if !defined(MBEDTLS_CONFIG_FILE)
|
|
#include "mbedtls/config.h"
|
|
#else
|
|
#include MBEDTLS_CONFIG_FILE
|
|
#endif
|
|
|
|
#include <sys/types.h>
|
|
#include <stdlib.h>
|
|
#include <stdio.h>
|
|
#include <esp_system.h>
|
|
|
|
#ifndef MBEDTLS_ENTROPY_HARDWARE_ALT
|
|
#error "MBEDTLS_ENTROPY_HARDWARE_ALT should always be set in ESP-IDF"
|
|
#endif
|
|
|
|
int mbedtls_hardware_poll( void *data,
|
|
unsigned char *output, size_t len, size_t *olen )
|
|
{
|
|
esp_fill_random(output, len);
|
|
*olen = len;
|
|
return 0;
|
|
}
|
|
|
|
|