mirror of
https://github.com/RGBCube/serenity
synced 2025-07-03 05:32:13 +00:00
Kernel: Make use of interrupts as an entropy source
Booting old computers without RDRAND/RDSEED and without a disk makes the system severely starved for entropy. Uses interrupts as a source to side-step that issue. Also warn whenever the system is starved of entropy, because that's a non-obvious failure mode.
This commit is contained in:
parent
cb89d3b780
commit
7eaefa5aa6
3 changed files with 16 additions and 2 deletions
|
@ -69,6 +69,7 @@ KernelRng::KernelRng()
|
|||
void KernelRng::wait_for_entropy()
|
||||
{
|
||||
if (!resource().is_ready()) {
|
||||
dbgln("Entropy starvation...");
|
||||
m_seed_queue.wait_on({}, "KernelRng");
|
||||
}
|
||||
}
|
||||
|
@ -80,7 +81,7 @@ void KernelRng::wake_if_ready()
|
|||
}
|
||||
}
|
||||
|
||||
size_t EntropySource::next_source { 0 };
|
||||
size_t EntropySource::next_source { static_cast<size_t>(EntropySource::Static::MaxHardcodedSourceIndex) };
|
||||
|
||||
void get_good_random_bytes(u8* buffer, size_t buffer_size)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue