Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages

  
 
  

home | help
GETENTROPY(2)		  FreeBSD System Calls Manual		 GETENTROPY(2)

NAME
     getentropy	-- get entropy

SYNOPSIS
     #include <unistd.h>

     int
     getentropy(void *buf, size_t buflen);

DESCRIPTION
     getentropy() fills	a buffer with high-quality entropy, which can be used
     as	input for process-context pseudorandom generators like arc4random(3).

     The maximum buffer	size permitted is 256 bytes.

     getentropy() is not intended for regular code; please use the
     arc4random(3) family of functions instead.

     The high-quality entropy data is provided by the random(4)	subsystem.

RETURN VALUES
     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.

ERRORS
     getentropy() will succeed unless:

     [EFAULT]		The buf	parameter points to an invalid address.

     [EIO]		Too many bytes requested, or some other	fatal error
			occurred.

SEE ALSO
     arc4random(3)

HISTORY
     The getentropy() function appeared	in OpenBSD 5.6.

FreeBSD	13.0		      September	28, 2019		  FreeBSD 13.0

NAME | SYNOPSIS | DESCRIPTION | RETURN VALUES | ERRORS | SEE ALSO | HISTORY

Want to link to this manual page? Use this URL:
<https://www.freebsd.org/cgi/man.cgi?query=getentropy&sektion=2&manpath=OpenBSD+6.9>

home | help