mirror of
https://github.com/polhenarejos/pico-keys-sdk
synced 2026-06-10 11:59:05 +02:00
@@ -32,7 +32,7 @@
|
||||
|
||||
static void hwrng_start(void) {
|
||||
#if defined(ENABLE_EMULATION)
|
||||
srand(time(0));
|
||||
srand((unsigned int)time(NULL));
|
||||
#elif defined(ESP_PLATFORM)
|
||||
bootloader_random_enable();
|
||||
#endif
|
||||
@@ -188,8 +188,7 @@ uint32_t hwrng_get(void) {
|
||||
|
||||
while (true) {
|
||||
hwrng_lock();
|
||||
bool empty = rb->empty;
|
||||
if (!empty) {
|
||||
if (!rb->empty) {
|
||||
v = hwrng_buf_del(rb);
|
||||
hwrng_unlock();
|
||||
break;
|
||||
@@ -210,9 +209,8 @@ void hwrng_wait_full(void) {
|
||||
#endif
|
||||
while (true) {
|
||||
hwrng_lock();
|
||||
bool full = rb->full;
|
||||
hwrng_unlock();
|
||||
if (full) {
|
||||
if (rb->full) {
|
||||
break;
|
||||
}
|
||||
#if defined(PICO_PLATFORM) || defined(ESP_PLATFORM)
|
||||
|
||||
@@ -80,7 +80,7 @@ const uint8_t *random_bytes_get(size_t len) {
|
||||
*/
|
||||
int random_fill_iterator(void *arg, unsigned char *out, size_t out_len) {
|
||||
random_fill_iterator_ctx_t *ctx = (random_fill_iterator_ctx_t *) arg;
|
||||
uint32_t index = ctx ? ctx->index : 0;
|
||||
uint8_t index = ctx ? ctx->index : 0;
|
||||
uint8_t n;
|
||||
int ret = 0;
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
#include <stdbool.h>
|
||||
|
||||
typedef struct {
|
||||
uint32_t index;
|
||||
uint8_t index;
|
||||
volatile bool cancel;
|
||||
} random_fill_iterator_ctx_t;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user