diff options
author | Anton Kling <anton@kling.gg> | 2023-11-23 17:01:55 +0100 |
---|---|---|
committer | Anton Kling <anton@kling.gg> | 2023-11-23 17:01:55 +0100 |
commit | 6757803629574fe46e9047be8567e0c7e0522973 (patch) | |
tree | cf31247efa27997b0b43bfed559ffbb42bfb8f3e /kernel/syscalls | |
parent | b8da260dd01175529feb57d5a73570f469decb08 (diff) |
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.
Diffstat (limited to 'kernel/syscalls')
-rw-r--r-- | kernel/syscalls/randomfill.c | 7 |
1 files changed, 7 insertions, 0 deletions
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 <random.h> +#include <typedefs.h> + +// 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); } |