159191Skris=pod
259191Skris
359191Skris=head1 NAME
459191Skris
559191SkrisRAND_load_file, RAND_write_file, RAND_file_name - PRNG seed file
659191Skris
759191Skris=head1 SYNOPSIS
859191Skris
959191Skris #include <openssl/rand.h>
1059191Skris
1176866Skris const char *RAND_file_name(char *buf, size_t num);
1259191Skris
1359191Skris int RAND_load_file(const char *filename, long max_bytes);
1459191Skris
1559191Skris int RAND_write_file(const char *filename);
1659191Skris
1759191Skris=head1 DESCRIPTION
1859191Skris
1959191SkrisRAND_file_name() generates a default path for the random seed
2059191Skrisfile. B<buf> points to a buffer of size B<num> in which to store the
2159191Skrisfilename. The seed file is $RANDFILE if that environment variable is
2259191Skrisset, $HOME/.rnd otherwise. If $HOME is not set either, or B<num> is
2359191Skristoo small for the path name, an error occurs.
2459191Skris
2559191SkrisRAND_load_file() reads a number of bytes from file B<filename> and
2659191Skrisadds them to the PRNG. If B<max_bytes> is non-negative,
2759191Skrisup to to B<max_bytes> are read; starting with OpenSSL 0.9.5,
2859191Skrisif B<max_bytes> is -1, the complete file is read.
2959191Skris
3059191SkrisRAND_write_file() writes a number of random bytes (currently 1024) to
3159191Skrisfile B<filename> which can be used to initialize the PRNG by calling
3259191SkrisRAND_load_file() in a later session.
3359191Skris
3459191Skris=head1 RETURN VALUES
3559191Skris
3659191SkrisRAND_load_file() returns the number of bytes read.
3759191Skris
3859191SkrisRAND_write_file() returns the number of bytes written, and -1 if the
3959191Skrisbytes written were generated without appropriate seed.
4059191Skris
4159191SkrisRAND_file_name() returns a pointer to B<buf> on success, and NULL on
4259191Skriserror.
4359191Skris
4459191Skris=head1 SEE ALSO
4559191Skris
4659191SkrisL<rand(3)|rand(3)>, L<RAND_add(3)|RAND_add(3)>, L<RAND_cleanup(3)|RAND_cleanup(3)>
4759191Skris
4859191Skris=head1 HISTORY
4959191Skris
5059191SkrisRAND_load_file(), RAND_write_file() and RAND_file_name() are available in
5159191Skrisall versions of SSLeay and OpenSSL.
5259191Skris
5359191Skris=cut
54