GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
GETENTROPY(3) FreeBSD Library Functions Manual GETENTROPY(3)

getentropy
get entropy

Standard C Library (libc, -lc)

#include <unistd.h>

int
getentropy(void *buf, size_t buflen);

getentropy() fills a buffer with high-quality random data.

The maximum buflen permitted is 256 bytes.

If it does not produce an error, getentropy() always provides the requested number of bytes of random data.

Similar to reading from /dev/urandom just after boot, getentropy() may block until the system has collected enough entropy to seed the CSPRNG.

The getentropy() function is implemented using getrandom(2).

Upon successful completion, the value 0 is returned; otherwise the value -1 is returned and the global variable errno is set to indicate the error.

getentropy() will succeed unless:
[]
The buf parameter points to an invalid address.
[]
Too many bytes requested, or some other fatal error occurred.

getrandom(2), arc4random(3), random(4)

getentropy() is non-standard. It is present on OpenBSD and Linux.

The getentropy() function appeared in OpenBSD 5.6. The FreeBSD libc compatibility shim first appeared in FreeBSD 12.0.
February 24, 2018 FreeBSD 13.1-RELEASE

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.