RAND_bytes 3 2008-05-09 0.9.9-dev OpenSSL
NAME
RAND_bytes, RAND_pseudo_bytes - generate random data
LIBRARY
libcrypto, -lcrypto
SYNOPSIS
#include
int RAND_bytes(unsigned char *buf, int num);
int RAND_pseudo_bytes(unsigned char *buf, int num);
DESCRIPTION
_R_A_N_D___b_y_t_e_s_(_) 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.
_R_A_N_D___p_s_e_u_d_o___b_y_t_e_s_(_) puts nnuumm pseudo-random bytes into bbuuff.
Pseudo-random byte sequences generated by _R_A_N_D___p_s_e_u_d_o___b_y_t_e_s_(_) will be
unique if they are of sufficient length, but are not necessarily
unpredictable. They can be used for non-cryptographic purposes and for
certain purposes in cryptographic protocols, but usually not for key
generation etc.
The contents of bbuuff is mixed into the entropy pool before retrieving
the new pseudo-random bytes unless disabled at compile time (see FAQ).
RETURN VALUES
_R_A_N_D___b_y_t_e_s_(_) returns 1 on success, 0 otherwise. The error code can be
obtained by _E_R_R___g_e_t___e_r_r_o_r(3). _R_A_N_D___p_s_e_u_d_o___b_y_t_e_s_(_) returns 1 if the
bytes generated are cryptographically strong, 0 otherwise. Both
functions return -1 if they are not supported by the current RAND
method.
SEE ALSO
_o_p_e_n_s_s_l___r_a_n_d(3), _E_R_R___g_e_t___e_r_r_o_r(3),
_R_A_N_D___a_d_d(3)
HISTORY
_R_A_N_D___b_y_t_e_s_(_) is available in all versions of SSLeay and OpenSSL. It
has a return value since OpenSSL 0.9.5. _R_A_N_D___p_s_e_u_d_o___b_y_t_e_s_(_) was added
in OpenSSL 0.9.5.