/* SPDX-License-Identifier: Unlicense */1#include <sys/types.h>2#include <stdlib.h>34#include <libecc/external_deps/rand.h>5#include <bsd_compat.h>67int8get_random(unsigned char *buf, uint16_t len)9{1011/*12* We need random numbers even in a sandbox, so we can't use13* /dev/urandom as the external_deps version of get_random() does on14* FreeBSD. arc4random_buf() is a better choice because it uses the15* underlying getrandom(2) instead of needing to open a device handle.16*17* We don't have any guarantees that this won't open a device on other18* platforms, but we also don't do any sandboxing on those platforms.19*/20arc4random_buf(buf, len);21return 0;22}232425