Seed badrand with an rtc read xored with itself (its called BADrand for a reason)

This commit is contained in:
Imbus 2025-10-01 02:42:45 +02:00
parent 0dbb13fea0
commit 802ac9c012

View file

@ -1,3 +1,4 @@
#include "badrand.h"
#include <assert.h> #include <assert.h>
#include <banner.h> #include <banner.h>
#include <buddy.h> #include <buddy.h>
@ -45,6 +46,7 @@ void start() {
memory_sweep(heap_start, heap_end); memory_sweep(heap_start, heap_end);
buddy_init(heap_start, heap_end); buddy_init(heap_start, heap_end);
spinlock_init(&sl); spinlock_init(&sl);
sbadrand(rtc_read_time() ^ swap64(rtc_read_time()));
for (int i = 0; i < banner_len; i++) uart_putc(banner[i]); for (int i = 0; i < banner_len; i++) uart_putc(banner[i]);
__sync_synchronize(); __sync_synchronize();
hold = 0; hold = 0;