From 6757803629574fe46e9047be8567e0c7e0522973 Mon Sep 17 00:00:00 2001 From: Anton Kling Date: Thu, 23 Nov 2023 17:01:55 +0100 Subject: Kernel/LibC: Add randomfill() syscall. This syscall aims to fill the given buffer with cryptographically secure random data. If the syscall returns and does not cause a page fault it will **always** have filled the buffer with random data and never gives back any error value. --- kernel/syscalls/randomfill.c | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 kernel/syscalls/randomfill.c (limited to 'kernel/syscalls') diff --git a/kernel/syscalls/randomfill.c b/kernel/syscalls/randomfill.c new file mode 100644 index 0000000..41f3ef0 --- /dev/null +++ b/kernel/syscalls/randomfill.c @@ -0,0 +1,7 @@ +#include +#include + +// This syscall will never fail. At worst a page fault will occur but if +// the syscall returns the buffer will have been filled with random +// data. +void syscall_randomfill(void *buffer, u32 size) { get_random(buffer, size); } -- cgit v1.2.3