Merge pull request #2957 from cesanta/picornd

Use Pico-SDK RNG
This commit is contained in:
Sergio R. Caprile authored and GitHub committed 2024-11-07 11:59:47 -03:00
commit 7a30a42797
8 files changed
+12 -4

No files matched your search

+1
View File
@@ -11,6 +11,7 @@
#include <time.h>
#include <pico/stdlib.h>
#include <pico/rand.h>
int mkdir(const char *, mode_t);
#if MG_OTA == MG_OTA_PICOSDK
+3
View File
@@ -17,6 +17,9 @@ bool mg_random(void *buf, size_t len) {
#if MG_ARCH == MG_ARCH_ESP32
while (len--) *p++ = (unsigned char) (esp_random() & 255);
success = true;
#elif MG_ARCH == MG_ARCH_RP2040
while (len--) *p++ = (unsigned char) (get_rand_32() & 255);
success = true;
#elif MG_ARCH == MG_ARCH_WIN32
static bool initialised = false;
#if defined(_MSC_VER) && _MSC_VER < 1700