NAME
RANDbytes, RANDpseudobytes - generate random data
SYNOPSIS
#include
int RANDbytes(unsigned char *buf, int num); int RANDpseudobytes(unsigned char *buf, int num);DESCRIPTION
RANDbytes() puts nnuumm cryptographically strong pseudo-random bytes into
bbuuff. An error occurs if the PRNG has not been seeded with enough randomness to ensure an unpredictable byte sequence.RANDpseudobytes() puts nnuumm pseudo-random bytes into bbuuff. Pseudo-
random byte sequences generated by RANDpseudobytes() will be unique if they are of sufficient length, but are not necessarilyunpredictable. They can be used for non-cryptographic purposes and for
certain purposes in cryptographic protocols, but usually not for key generation etc.RETURN VALUES
RANDbytes() returns 1 on success, 0 otherwise. The error code can be obtained by ERRgeterror(3). RANDpseudobytes() returns 1 if the bytes generated are cryptographically strong, 0 otherwise. Bothfunctions return -1 if they are not supported by the current RAND
method.SEE ALSO
rand(3), ERRgeterror(3), RANDadd(3) HISTORY RANDbytes() is available in all versions of SSLeay and OpenSSL. It has a return value since OpenSSL 0.9.5. RANDpseudobytes() was added in OpenSSL 0.9.5.0.9.7l 2002-09-25 RANDbytes(3)