SysSrandom(), SysSrandom_r()

Updated: April 19, 2023

Supply entropy to the kernel's pseudorandom number generator

Synopsis:

#include <sys/neutrino.h>

int SysSrandom( const uint64_t *seedp );

int SysSrandom_r( const uint64_t *seedp );

Arguments:

seedp
A pointer to a 64-bit seed.

Library:

libc

Use the -l c option to qcc to link against this library. This library is usually included automatically.

Description:

The SysSrandom() and SysSrandom_r() kernel calls set one source of entropy that's used for the kernel's pseudorandom number generator (PRNG). The PRNG is used with address space layout randomization (ASLR). For more information about ASLR, refer to “Address space layout randomization (ASLR)” in the System Security Guide. These calls make it possible to use an external source, such as a random number generator implemented in hardware, to augment the other sources of entropy.

These functions are identical except in the way they indicate errors. See the Returns section for details.

Note:
  • In order to use these calls, your process must have the PROCMGR_AID_SRANDOM ability enabled. For more information, see procmgr_ability().
  • Trace event logs intentionally don't include the new value of the source of entropy, for security reasons.

Blocking states

These calls don't block.

Returns:

EOK. If an error occurs:

Errors:

EPERM
The calling process doesn't have the required permission; see procmgr_ability().

Classification:

QNX Neutrino

Safety:  
Cancellation point No
Interrupt handler No
Signal handler Yes
Thread Yes