5 RAND_bytes, RAND_pseudo_bytes - Generate random data
9 #include <openssl/rand.h>
11 int RAND_bytes(unsigned char *buf, int num);
13 int RAND_pseudo_bytes(unsigned char *buf, int num);
17 RAND_bytes() puts B<num> random bytes into B<buf>. An error occurs if
18 the PRNG has not been seeded with enough randomness.
20 RAND_pseudo_bytes() puts B<num> pseudo-random bytes into B<buf>. These
21 bytes are guaranteed to be unique, but not unpredictable. They can be
22 used for non-cryptographic purposes and for certain purposes in
23 cryptographic protocols, but not for key generation etc.
27 RAND_bytes() returns 1 on success, 0 otherwise. The error code can be
28 obtained by ERR_get_error(3). RAND_pseudo_bytes() returns 1 if the
29 bytes generated are cryptographically strong, 0 otherwise. Both
30 functions return -1 if they are not supported by the current RAND
35 rand(3), err(3), RAND_add(3)
39 RAND_bytes() is available in all versions of SSLeay and OpenSSL. It
40 has a return value since OpenSSL 0.9.5. RAND_pseudo_bytes() was added