1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 13:48:12 +00:00

Kernel: Harvest randomness from various drivers

Random now gets entropy from the following drivers:
- KeyboardDevice
- PATAChannel
- PS2MouseDevice
- E1000NetworkAdapter
- RTL8139NetworkAdapter

Of these devices,  PS2MouseDevice and PATAChannel provide the vast
majority of the entropy.
This commit is contained in:
Peter Elliott 2020-06-24 14:07:28 -06:00 committed by Andreas Kling
parent 2e8cfe5435
commit af0b2d1d86
12 changed files with 71 additions and 7 deletions

View file

@ -204,6 +204,9 @@ void E1000NetworkAdapter::handle_irq(const RegisterState&)
out32(REG_INTERRUPT_MASK_CLEAR, 0xffffffff);
u32 status = in32(REG_INTERRUPT_CAUSE_READ);
m_entropy_source.add_random_event(status);
if (status & 4) {
u32 flags = in32(REG_CTRL);
out32(REG_CTRL, flags | ECTRL_SLU);