Merge pull request #155 from SuperHouse/libc_hwrand
Seed libc PRNG from hardware RNG on reset
This commit is contained in:
commit
78c5b43a40
1 changed files with 3 additions and 0 deletions
|
@ -21,6 +21,7 @@
|
||||||
#include "esp/spi_regs.h"
|
#include "esp/spi_regs.h"
|
||||||
#include "esp/dport_regs.h"
|
#include "esp/dport_regs.h"
|
||||||
#include "esp/wdev_regs.h"
|
#include "esp/wdev_regs.h"
|
||||||
|
#include "esp/hwrand.h"
|
||||||
#include "os_version.h"
|
#include "os_version.h"
|
||||||
|
|
||||||
#include "espressif/esp_common.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);
|
init_networking(&phy_info, sdk_info.sta_mac_addr);
|
||||||
|
|
||||||
|
srand(hwrand()); /* seed libc rng */
|
||||||
|
|
||||||
// Call gcc constructor functions
|
// Call gcc constructor functions
|
||||||
void (**ctor)(void);
|
void (**ctor)(void);
|
||||||
for ( ctor = &__init_array_start; ctor != &__init_array_end; ++ctor) {
|
for ( ctor = &__init_array_start; ctor != &__init_array_end; ++ctor) {
|
||||||
|
|
Loading…
Reference in a new issue