2015-09-18 05:12:09 +00:00
|
|
|
/* ESP8266 "Hardware RNG" (validity still being confirmed) support for ESP8266
|
|
|
|
*
|
|
|
|
* Based on research done by @foogod.
|
|
|
|
*
|
|
|
|
* Please don't rely on this too much as an entropy source, quite yet...
|
|
|
|
*
|
|
|
|
* Part of esp-open-rtos
|
|
|
|
* Copyright (C) 2015 Angus Gratton
|
|
|
|
* BSD Licensed as described in the file LICENSE
|
|
|
|
*/
|
|
|
|
#include <mbedtls/entropy_poll.h>
|
2015-09-24 10:48:16 +00:00
|
|
|
#include <esp/hwrand.h>
|
2015-09-18 05:12:09 +00:00
|
|
|
|
|
|
|
int mbedtls_hardware_poll( void *data,
|
|
|
|
unsigned char *output, size_t len, size_t *olen )
|
|
|
|
{
|
|
|
|
(void)(data);
|
2015-09-24 10:48:16 +00:00
|
|
|
hwrand_fill(output, len);
|
2015-09-18 05:12:09 +00:00
|
|
|
if(olen)
|
|
|
|
*olen = len;
|
|
|
|
return 0;
|
|
|
|
}
|