5 rand - pseudo-random number generator
9 #include <openssl/rand.h>
11 int RAND_set_rand_engine(ENGINE *engine);
13 int RAND_bytes(unsigned char *buf, int num);
14 int RAND_pseudo_bytes(unsigned char *buf, int num);
16 void RAND_seed(const void *buf, int num);
17 void RAND_add(const void *buf, int num, int entropy);
18 int RAND_status(void);
20 int RAND_load_file(const char *file, long max_bytes);
21 int RAND_write_file(const char *file);
22 const char *RAND_file_name(char *file, size_t num);
24 int RAND_egd(const char *path);
26 void RAND_set_rand_method(const RAND_METHOD *meth);
27 const RAND_METHOD *RAND_get_rand_method(void);
28 RAND_METHOD *RAND_OpenSSL(void);
30 void RAND_cleanup(void);
33 void RAND_screen(void);
34 int RAND_event(UINT, WPARAM, LPARAM);
38 Since the introduction of the ENGINE API, the recommended way of controlling
39 default implementations is by using the ENGINE API functions. The default
40 B<RAND_METHOD>, as set by RAND_set_rand_method() and returned by
41 RAND_get_rand_method(), is only used if no ENGINE has been set as the default
42 "rand" implementation. Hence, these two functions are no longer the recommended
43 way to control defaults.
45 If an alternative B<RAND_METHOD> implementation is being used (either set
46 directly or as provided by an ENGINE module), then it is entirely responsible
47 for the generation and management of a cryptographically secure PRNG stream. The
48 mechanisms described below relate solely to the software PRNG implementation
49 built in to OpenSSL and used by default.
51 These functions implement a cryptographically secure pseudo-random
52 number generator (PRNG). It is used by other library functions for
53 example to generate random keys, and applications can use it when they
56 A cryptographic PRNG must be seeded with unpredictable data such as
57 mouse movements or keys pressed at random by the user. This is
58 described in L<RAND_add(3)>. Its state can be saved in a seed file
59 (see L<RAND_load_file(3)>) to avoid having to go through the
60 seeding process whenever the application is started.
62 L<RAND_bytes(3)> describes how to obtain random data from the
67 L<BN_rand(3)>, L<RAND_add(3)>,
68 L<RAND_load_file(3)>, L<RAND_egd(3)>,
70 L<RAND_set_rand_method(3)>,