1RAND_load_file(3) OpenSSL RAND_load_file(3)
2
3
4
6 RAND_load_file, RAND_write_file, RAND_file_name - PRNG seed file
7
9 #include <openssl/rand.h>
10
11 const char *RAND_file_name(char *buf, size_t num);
12
13 int RAND_load_file(const char *filename, long max_bytes);
14
15 int RAND_write_file(const char *filename);
16
18 RAND_file_name() generates a default path for the random seed file. buf
19 points to a buffer of size num in which to store the filename. The seed
20 file is $RANDFILE if that environment variable is set, $HOME/.rnd
21 otherwise. If $HOME is not set either, or num is too small for the path
22 name, an error occurs.
23
24 RAND_load_file() reads a number of bytes from file filename and adds
25 them to the PRNG. If max_bytes is non-negative, up to to max_bytes are
26 read; starting with OpenSSL 0.9.5, if max_bytes is -1, the complete
27 file is read.
28
29 RAND_write_file() writes a number of random bytes (currently 1024) to
30 file filename which can be used to initialize the PRNG by calling
31 RAND_load_file() in a later session.
32
34 RAND_load_file() returns the number of bytes read.
35
36 RAND_write_file() returns the number of bytes written, and -1 if the
37 bytes written were generated without appropriate seed.
38
39 RAND_file_name() returns a pointer to buf on success, and NULL on
40 error.
41
43 rand(3), RAND_add(3), RAND_cleanup(3)
44
46 RAND_load_file(), RAND_write_file() and RAND_file_name() are available
47 in all versions of SSLeay and OpenSSL.
48
49
50
511.0.2k 2017-01-26 RAND_load_file(3)