Merge pull request #155 from SuperHouse/libc_hwrand

Seed libc PRNG from hardware RNG on reset
This commit is contained in:
Angus Gratton 2016-07-06 17:18:45 +10:00 committed by GitHub
commit 78c5b43a40

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) {