From 057193e855ca0b5873191c327184052765781ddf Mon Sep 17 00:00:00 2001 From: robert Date: Sun, 23 Aug 2020 12:12:11 +0200 Subject: [PATCH] esp8266/mpconfigport.h: Seed the urandom module on import. For seeding, the hardware RNG of the esp8266 is used. --- ports/esp8266/mpconfigport.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ports/esp8266/mpconfigport.h b/ports/esp8266/mpconfigport.h index 974310f84d..99cf2ade4d 100644 --- a/ports/esp8266/mpconfigport.h +++ b/ports/esp8266/mpconfigport.h @@ -26,6 +26,7 @@ #define MICROPY_HELPER_REPL (1) #define MICROPY_HELPER_LEXER_UNIX (0) #define MICROPY_ENABLE_SOURCE_LINE (1) +#define MICROPY_MODULE_BUILTIN_INIT (1) #define MICROPY_MODULE_WEAK_LINKS (1) #define MICROPY_CAN_OVERRIDE_BUILTINS (1) #define MICROPY_USE_INTERNAL_ERRNO (1) @@ -69,6 +70,7 @@ #define MICROPY_PY_UTIMEQ (1) #define MICROPY_PY_UJSON (1) #define MICROPY_PY_URANDOM (1) +#define MICROPY_PY_URANDOM_SEED_INIT_FUNC (*WDEV_HWRNG) #define MICROPY_PY_URE (1) #define MICROPY_PY_USELECT (1) #define MICROPY_PY_UTIME_MP_HAL (1) @@ -197,4 +199,6 @@ extern const struct _mp_obj_module_t mp_module_onewire; #define MICROPY_WRAP_MP_KEYBOARD_INTERRUPT(f) MP_FASTCODE(f) #define MICROPY_WRAP_MP_SCHED_SCHEDULE(f) MP_FASTCODE(f) +#define WDEV_HWRNG ((volatile uint32_t *)0x3ff20e44) + #define _assert(expr) ((expr) ? (void)0 : __assert_func(__FILE__, __LINE__, __func__, #expr))