NetBSD/include
nia 5e1fba1a1e Add getentropy() to libc - a simple wrapper to access the kernel CSPRNG.
Posted to tech-userlevel@ a week ago and reviewed by riastradh@.

GETENTROPY(3)		   Library Functions Manual		 GETENTROPY(3)

NAME
     getentropy - fill a buffer with high quality random data

LIBRARY
     Standard C Library (libc, -lc)

SYNOPSIS
     #include <unistd.h>

     int
     getentropy(void *buf, size_t buflen);

DESCRIPTION
     The getentropy() function fills a buffer with high quality random data,
     suitable for seeding cryptographically secure psuedorandom number
     generators.

     getentropy() is only intended for seeding random number generators and is
     not intended for use by regular code which simply needs secure random
     data.  For this purpose, please use arc4random(3).

     The maximum value for buflen is 256 bytes.

IMPLEMENTATION NOTES
     getentropy() reads from the sysctl(7) variable kern.arandom.

RETURN VALUES
     The getentropy() function returns 0 on success, and -1 if an error
     occurred.

ERRORS
     getentropy() will succeed unless:

     [EFAULT]		The buf argument points to an invalid memory address.

     [EIO]		Too many bytes were requested.

SEE ALSO
     arc4random(3), rnd(4)

STANDARDS
     The getentropy() function is non-standard.

HISTORY
     The getentropy() function first appeared in OpenBSD 5.6, then in
     FreeBSD 12.0, and NetBSD 10.
2020-05-06 16:17:36 +00:00
..
arpa Welcome to the constant age! 2017-01-12 18:42:53 +00:00
protocols Fix depenency on common symbols in sbin. 2020-04-05 15:25:39 +00:00
rpc Move the basic part of XDR to common/include/rpc and common/lib/libc/rpc. 2019-06-04 15:07:55 +00:00
rpcsvc s/impliment/implement/ in comment. 2020-04-02 15:30:25 +00:00
ssp correct __ssp_overlap() to not trigger for adjacent areas 2015-09-03 20:43:47 +00:00
Makefile Move the basic part of XDR to common/include/rpc and common/lib/libc/rpc. 2019-06-04 15:07:55 +00:00
a.out.h
aio.h
ar.h
assert.h Remove the static_assert() fallback for pre-C11 and pre-C++11 2020-04-17 15:22:34 +00:00
atomic.h
bitstring.h more casting fixes 2016-03-17 02:25:32 +00:00
bm.h Needs stddef.h for size_t. 2016-01-22 22:27:01 +00:00
cdbw.h Prototype for cdbw_stable_seeder. 2012-06-03 21:21:45 +00:00
complex.h Add missing long double prototypes. 2013-01-28 23:19:50 +00:00
cpio.h
ctype.h Fix visibility of various C99 features, esp. for C++11. 2020-03-20 01:08:42 +00:00
db.h sync with mit/kerberos db 2016-09-24 20:11:43 +00:00
dirent.h scandir/alphasort take "const struct dirent **" not "const void *" in 2016-12-16 04:45:04 +00:00
disktab.h
dlfcn.h Implement __cxa_thread_atexit and __cxa_thread_atexit_impl. This 2017-07-11 15:21:31 +00:00
endian.h Add endian.h header. Simply includes sys/endian.h 2017-10-16 11:38:25 +00:00
err.h Add the {v,}{warn,err}c function flavors from FreeBSD 2014-01-16 17:22:06 +00:00
errno.h
fenv.h fexcept_t + fenv_t should be handled the same way for softfloat 2017-04-09 15:29:07 +00:00
fmtmsg.h
fnmatch.h
fstab.h
fts.h
ftw.h
getopt.h
glob.h Add GLOB_TILDE_CHECK (from GNU) 2019-05-29 01:21:33 +00:00
grp.h
hesiod.h
iconv.h Switch the iconv(3) prototype to the POSIX conformant variation 2019-10-24 18:17:14 +00:00
ieeefp.h finish the ieeefp.h vs fp_prec_t hack from the previous change and 2011-03-27 05:13:15 +00:00
ifaddrs.h Add ifa_addrflags to ifaddrs (forgot to commit this file, thanks Ryo!) 2016-09-21 13:32:27 +00:00
inttypes.h strtoi and strtou additions 2015-01-16 18:35:59 +00:00
iso646.h Do not define the C++ alternative operator names as macros. 2013-04-26 10:58:45 +00:00
kvm.h u_char, u_int, u_long -> unsigned char, unsigned, unsigned long 2016-01-22 21:55:57 +00:00
langinfo.h Add nl_langinfo_l, catopen_l and wcsftime_l. 2013-08-19 08:03:33 +00:00
libgen.h
limits.h remove comment for incomplete x/open impl (kamil) 2019-09-15 23:52:59 +00:00
link.h
link_aout.h Apparently a recent round of vandalism by the C++ standards committee 2016-01-23 01:26:14 +00:00
link_elf.h
locale.h Go back to just using normal visibility for the locale symbols. Without 2016-04-29 16:26:48 +00:00
login_cap.h Apparently a recent round of vandalism by the C++ standards committee 2016-01-23 01:26:14 +00:00
lwp.h make _lwp_park return the remaining time to sleep in the "ts" argument 2017-12-08 01:19:29 +00:00
malloc.h remove global pointers, add get/seters. 2019-03-12 15:11:13 +00:00
math.h Correct C99 / C++11 feature testing. Document remaining missing symbols. 2020-02-22 22:47:35 +00:00
md2.h define block length 2016-07-01 16:42:46 +00:00
memory.h
mntopts.h Merge autofs support from: Tomohiro Kusumi 2018-01-09 03:31:12 +00:00
monetary.h PR lib/54744 (bruno@haible.de) 2019-12-08 02:15:02 +00:00
mpool.h remove mpool_getf 2016-09-24 21:18:09 +00:00
mqueue.h
ndbm.h
netconfig.h
netdb.h fix gethostbyaddr prototype per TOG. 2013-08-19 07:18:42 +00:00
netgroup.h
nl_types.h Add nl_langinfo_l, catopen_l and wcsftime_l. 2013-08-19 08:03:33 +00:00
nlist.h
nsswitch.h Apparently a recent round of vandalism by the C++ standards committee 2016-01-23 01:26:14 +00:00
paths.h add _PATH_DEVZERO 2017-01-16 19:15:28 +00:00
pwd.h revert previous commit since it breaks the build on NetBSD and 2012-11-26 19:53:41 +00:00
quota.h Add RCS tag. 2017-04-04 12:25:40 +00:00
randomid.h Needs stdint.h. 2016-01-22 23:15:42 +00:00
ranlib.h
re_comp.h
regex.h rename to regnsub 2016-01-14 21:45:18 +00:00
regexp.h
res_update.h use standard queue macros. 2012-11-15 18:49:37 +00:00
resolv.h add <netinet/in.h> because it is needed for sockaddr_in. 2012-11-07 15:45:24 +00:00
rmt.h Needs sys/types.h for mode_t, off_t, ssize_t, and others. 2016-01-22 23:15:58 +00:00
sched.h
search.h amend the new destroy function to take function pointers. 2014-07-20 20:17:21 +00:00
semaphore.h Define SEM_VALUE_MAX in only one place. 2016-04-24 19:48:29 +00:00
setjmp.h Add __returns_twice for the attribute of the same name. This makes the 2011-11-05 09:27:06 +00:00
sgtty.h
signal.h Provide global variables with C linkage, otherwise they will create 2019-01-08 17:35:42 +00:00
spawn.h Use C++ compatible declaration for posix_spawn (instead of the C99 specific 2012-02-22 17:51:01 +00:00
stab.h
stdalign.h Import <stdalign.h> 2016-10-02 17:19:00 +00:00
stddef.h Revert previous 2020-03-01 22:08:17 +00:00
stdio.h Fix visibility of various C99 features, esp. for C++11. 2020-03-20 01:08:42 +00:00
stdlib.h We can make a stronger guarantee than __pure. 2019-01-05 09:16:46 +00:00
stdnoreturn.h Import <stdnoreturn.h> 2016-10-02 13:09:24 +00:00
string.h Mark in string.h: memccpy(3) and strdup(3) as _POSIX_C_SOURCE >= 2001 2018-02-20 02:35:24 +00:00
stringlist.h
strings.h Don't pollute the namespace with stdint.h. (This file is included from 2011-08-22 01:24:15 +00:00
struct.h
sysexits.h
tar.h
tgmath.h Add RCS tag. 2017-04-04 12:25:40 +00:00
time.h Add timespec_get(3) in <time.h> and enable unconditionally struct timespec 2016-10-04 09:41:40 +00:00
ttyent.h Systematically include sys/featuretest.h when _NETBSD_SOURCE is used. 2013-04-27 21:35:24 +00:00
tzfile.h Sync with 2019b (field name change) 2019-07-03 15:49:21 +00:00
ucontext.h fixes for GCC 6: 2018-02-04 01:13:45 +00:00
ulimit.h
unistd.h Add getentropy() to libc - a simple wrapper to access the kernel CSPRNG. 2020-05-06 16:17:36 +00:00
util.h Implement pidfile_lock, pidfile_read and pidfile_clean. 2016-04-10 19:05:50 +00:00
utime.h
utmp.h Needs sys/cdefs.h for __BEGIN_DECLS. Also add time.h to get time_t, 2016-01-22 23:59:44 +00:00
utmpx.h
uuid.h
vis.h Add vis DQ. 2017-04-23 01:57:36 +00:00
wchar.h Fix visibility of various C99 features, esp. for C++11. 2020-03-20 01:08:42 +00:00
wctype.h Systematically include sys/featuretest.h when _NETBSD_SOURCE is used. 2013-04-27 21:35:24 +00:00
wordexp.h