aboutsummaryrefslogtreecommitdiff
path: root/sys/compat
diff options
context:
space:
mode:
authorConrad Meyer <cem@FreeBSD.org>2018-03-21 01:15:45 +0000
committerConrad Meyer <cem@FreeBSD.org>2018-03-21 01:15:45 +0000
commite9ac27430c0c639c1f89b1f048a44f6cea0ec265 (patch)
tree4db48083e97206fa5c935d41e2e7c09a9c7ed033 /sys/compat
parent672756aa9f1033719fff013226f46b3e46fe3ea5 (diff)
downloadsrc-e9ac27430c0c639c1f89b1f048a44f6cea0ec265.tar.gz
src-e9ac27430c0c639c1f89b1f048a44f6cea0ec265.zip
Implement getrandom(2) and getentropy(3)
The general idea here is to provide userspace programs with well-defined sources of entropy, in a fashion that doesn't require opening a new file descriptor (ulimits) or accessing paths (/dev/urandom may be restricted by chroot or capsicum). getrandom(2) is the more general API, and comes from the Linux world. Since our urandom and random devices are identical, the GRND_RANDOM flag is ignored. getentropy(3) is added as a compatibility shim for the OpenBSD API. truss(1) support is included. Tests for both system calls are provided. Coverage is believed to be at least as comprehensive as LTP getrandom(2) test coverage. Additionally, instructions for running the LTP tests directly against FreeBSD are provided in the "Test Plan" section of the Differential revision linked below. (They pass, of course.) PR: 194204 Reported by: David CARLIER <david.carlier AT hardenedbsd.org> Discussed with: cperciva, delphij, jhb, markj Relnotes: maybe Differential Revision: https://reviews.freebsd.org/D14500
Notes
Notes: svn path=/head/; revision=331279
Diffstat (limited to 'sys/compat')
-rw-r--r--sys/compat/freebsd32/syscalls.master2
1 files changed, 2 insertions, 0 deletions
diff --git a/sys/compat/freebsd32/syscalls.master b/sys/compat/freebsd32/syscalls.master
index 50613d037ca8..6e9a3a63d61f 100644
--- a/sys/compat/freebsd32/syscalls.master
+++ b/sys/compat/freebsd32/syscalls.master
@@ -1116,5 +1116,7 @@
cpuwhich_t which, uint32_t id1, uint32_t id2, \
size_t domainsetsize, domainset_t *mask, \
int policy); }
+563 AUE_NULL NOPROTO { int getrandom(void *buf, size_t buflen, \
+ unsigned int flags); }
; vim: syntax=off