mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 15:48:12 +00:00
Kernel: Fix undefined signed overflow in KernelRng's RTC fallback
This commit is contained in:
parent
eedb6480df
commit
f8c352a022
1 changed files with 3 additions and 3 deletions
|
@ -77,11 +77,11 @@ KernelRng::KernelRng()
|
|||
} else {
|
||||
// Fallback to RTC
|
||||
klog() << "KernelRng: Using RTC as entropy source (bad!)";
|
||||
time_t current_time = RTC::now();
|
||||
auto current_time = static_cast<u64>(RTC::now());
|
||||
for (size_t i = 0; i < resource().pool_count * resource().reseed_threshold; ++i) {
|
||||
this->resource().add_random_event(current_time, i % 32);
|
||||
current_time *= 0x574a;
|
||||
current_time += 0x40b2;
|
||||
current_time *= 0x574au;
|
||||
current_time += 0x40b2u;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue