xref: /minix3/crypto/external/bsd/openssl/dist/doc/crypto/RAND_load_file.pod (revision ebfedea0ce5bbe81e252ddf32d732e40fb633fae)
1*ebfedea0SLionel Sambuc=pod
2*ebfedea0SLionel Sambuc
3*ebfedea0SLionel Sambuc=head1 NAME
4*ebfedea0SLionel Sambuc
5*ebfedea0SLionel SambucRAND_load_file, RAND_write_file, RAND_file_name - PRNG seed file
6*ebfedea0SLionel Sambuc
7*ebfedea0SLionel Sambuc=head1 SYNOPSIS
8*ebfedea0SLionel Sambuc
9*ebfedea0SLionel Sambuc #include <openssl/rand.h>
10*ebfedea0SLionel Sambuc
11*ebfedea0SLionel Sambuc const char *RAND_file_name(char *buf, size_t num);
12*ebfedea0SLionel Sambuc
13*ebfedea0SLionel Sambuc int RAND_load_file(const char *filename, long max_bytes);
14*ebfedea0SLionel Sambuc
15*ebfedea0SLionel Sambuc int RAND_write_file(const char *filename);
16*ebfedea0SLionel Sambuc
17*ebfedea0SLionel Sambuc=head1 DESCRIPTION
18*ebfedea0SLionel Sambuc
19*ebfedea0SLionel SambucRAND_file_name() generates a default path for the random seed
20*ebfedea0SLionel Sambucfile. B<buf> points to a buffer of size B<num> in which to store the
21*ebfedea0SLionel Sambucfilename. The seed file is $RANDFILE if that environment variable is
22*ebfedea0SLionel Sambucset, $HOME/.rnd otherwise. If $HOME is not set either, or B<num> is
23*ebfedea0SLionel Sambuctoo small for the path name, an error occurs.
24*ebfedea0SLionel Sambuc
25*ebfedea0SLionel SambucRAND_load_file() reads a number of bytes from file B<filename> and
26*ebfedea0SLionel Sambucadds them to the PRNG. If B<max_bytes> is non-negative,
27*ebfedea0SLionel Sambucup to to B<max_bytes> are read; starting with OpenSSL 0.9.5,
28*ebfedea0SLionel Sambucif B<max_bytes> is -1, the complete file is read.
29*ebfedea0SLionel Sambuc
30*ebfedea0SLionel SambucRAND_write_file() writes a number of random bytes (currently 1024) to
31*ebfedea0SLionel Sambucfile B<filename> which can be used to initialize the PRNG by calling
32*ebfedea0SLionel SambucRAND_load_file() in a later session.
33*ebfedea0SLionel Sambuc
34*ebfedea0SLionel Sambuc=head1 RETURN VALUES
35*ebfedea0SLionel Sambuc
36*ebfedea0SLionel SambucRAND_load_file() returns the number of bytes read.
37*ebfedea0SLionel Sambuc
38*ebfedea0SLionel SambucRAND_write_file() returns the number of bytes written, and -1 if the
39*ebfedea0SLionel Sambucbytes written were generated without appropriate seed.
40*ebfedea0SLionel Sambuc
41*ebfedea0SLionel SambucRAND_file_name() returns a pointer to B<buf> on success, and NULL on
42*ebfedea0SLionel Sambucerror.
43*ebfedea0SLionel Sambuc
44*ebfedea0SLionel Sambuc=head1 SEE ALSO
45*ebfedea0SLionel Sambuc
46*ebfedea0SLionel SambucL<rand(3)|rand(3)>, L<RAND_add(3)|RAND_add(3)>, L<RAND_cleanup(3)|RAND_cleanup(3)>
47*ebfedea0SLionel Sambuc
48*ebfedea0SLionel Sambuc=head1 HISTORY
49*ebfedea0SLionel Sambuc
50*ebfedea0SLionel SambucRAND_load_file(), RAND_write_file() and RAND_file_name() are available in
51*ebfedea0SLionel Sambucall versions of SSLeay and OpenSSL.
52*ebfedea0SLionel Sambuc
53*ebfedea0SLionel Sambuc=cut
54