1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 00:17:46 +00:00

Kernel: Convert random bytes interface to use AK::Bytes

This commit is contained in:
Brian Gianforcaro 2021-08-31 23:28:47 -07:00 committed by Andreas Kling
parent 0678ac265c
commit f3baa5d8c9
5 changed files with 20 additions and 19 deletions

View file

@ -724,7 +724,7 @@ static Vector<ELF::AuxiliaryValue> generate_auxiliary_vector(FlatPtr load_base,
auxv.append({ ELF::AuxiliaryValue::Secure, ((uid != euid) || (gid != egid)) ? 1 : 0 });
char random_bytes[16] {};
get_fast_random_bytes((u8*)random_bytes, sizeof(random_bytes));
get_fast_random_bytes({ (u8*)random_bytes, sizeof(random_bytes) });
auxv.append({ ELF::AuxiliaryValue::Random, String(random_bytes, sizeof(random_bytes)) });

View file

@ -24,7 +24,7 @@ KResultOr<FlatPtr> Process::sys$getrandom(Userspace<void*> buffer, size_t buffer
if (!data_buffer.has_value())
return EFAULT;
auto result = data_buffer.value().write_buffered<1024>(buffer_size, [&](u8* buffer, size_t buffer_bytes) {
get_good_random_bytes(buffer, buffer_bytes);
get_good_random_bytes({ buffer, buffer_bytes });
return buffer_bytes;
});
if (result.is_error())