mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-25 09:00:22 +00:00
Kernel/riscv64: Use TimeManagement as an entropy source for now
Better entropy will require us to parse the riscv,isa devicetree property and then use the Zkr extension, if present.
This commit is contained in:
parent
f6151b3c9e
commit
cd389833d4
Notes:
sideshowbarker
2024-07-16 17:05:37 +09:00
Author: https://github.com/spholz Commit: https://github.com/SerenityOS/serenity/commit/cd389833d4 Pull-request: https://github.com/SerenityOS/serenity/pull/23314 Reviewed-by: https://github.com/ADKaster ✅
1 changed files with 9 additions and 0 deletions
|
@ -77,6 +77,15 @@ UNMAP_AFTER_INIT KernelRng::KernelRng()
|
||||||
current_time += 0x40b2u;
|
current_time += 0x40b2u;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#elif ARCH(RISCV64)
|
||||||
|
// Fallback to TimeManagement as entropy
|
||||||
|
dmesgln("KernelRng: Using bad entropy source TimeManagement");
|
||||||
|
auto current_time = static_cast<u64>(TimeManagement::now().milliseconds_since_epoch());
|
||||||
|
for (size_t i = 0; i < pool_count * reseed_threshold; ++i) {
|
||||||
|
add_random_event(current_time, i % 32);
|
||||||
|
current_time *= 0x574au;
|
||||||
|
current_time += 0x40b2u;
|
||||||
|
}
|
||||||
#else
|
#else
|
||||||
dmesgln("KernelRng: No entropy source available!");
|
dmesgln("KernelRng: No entropy source available!");
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue