1 .\" Copyright (C) 2017, Michael Kerrisk <mtk.manpages@gmail.com>
3 .\" %%%LICENSE_START(VERBATIM)
4 .\" Permission is granted to make and distribute verbatim copies of this
5 .\" manual provided the copyright notice and this permission notice are
6 .\" preserved on all copies.
8 .\" Permission is granted to copy and distribute modified versions of
9 .\" this manual under the conditions for verbatim copying, provided that
10 .\" the entire resulting derived work is distributed under the terms of
11 .\" a permission notice identical to this one.
13 .\" Since the Linux kernel and libraries are constantly changing, this
14 .\" manual page may be incorrect or out-of-date. The author(s) assume.
15 .\" no responsibility for errors or omissions, or for damages resulting.
16 .\" from the use of the information contained herein. The author(s) may.
17 .\" not have taken the same level of care in the production of this.
18 .\" manual, which is licensed free of charge, as they might when working.
21 .\" Formatted or processed versions of this manual, if unaccompanied by
22 .\" the source, must acknowledge the copyright and authors of this work.
25 .TH GETENTROPY 3 2017-09-15 "Linux" "Linux Programmer's Manual"
27 getentropy \- fill a buffer with random bytes
29 .B #include <unistd.h>
31 .BI "int getentropy(void *" buffer ", size_t " length );
34 Feature Test Macro Requirements for glibc (see
35 .BR feature_test_macros (7)):
50 bytes of high-quality random data to the buffer starting
51 at the location pointed to by
53 The maximum permitted value for the
59 always provides the requested number of bytes of entropy.
61 On success, this function returns zero.
62 On error, \-1 is returned, and
68 Part or all of the buffer specified by
72 is not in valid addressable memory.
79 An unspecified error occurred while trying to overwrite
84 This kernel version does not implement the
86 system call required to implement this function.
90 function first appeared in glibc 2.25.
92 This function is nonstandard.
93 It is also present on OpenBSD.
97 function is implemented using
100 Whereas the glibc wrapper makes
102 a cancellation point,
104 is not a cancellation point.
109 (No feature test macro need be defined to obtain the declaration from
114 may block if the system has just booted and the kernel has
115 not yet collected enough randomness to initialize the entropy pool.
118 will keep blocking even if a signal is handled,
119 and will return only once the entropy pool has been initialized.