Seed libc PRNG from hardware RNG on reset

This commit is contained in:
Angus Gratton 2016-06-30 08:18:10 +10:00
parent 587c867d4b
commit 04b119a61e

View file

@ -21,6 +21,7 @@
#include "esp/spi_regs.h"
#include "esp/dport_regs.h"
#include "esp/wdev_regs.h"
#include "esp/hwrand.h"
#include "os_version.h"
#include "espressif/esp_common.h"
@ -378,6 +379,8 @@ static __attribute__((noinline)) void user_start_phase2(void) {
init_networking(&phy_info, sdk_info.sta_mac_addr);
srand(hwrand()); /* seed libc rng */
// Call gcc constructor functions
void (**ctor)(void);
for ( ctor = &__init_array_start; ctor != &__init_array_end; ++ctor) {