RAND_load_file.pod 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. =pod
  2. =head1 NAME
  3. RAND_load_file, RAND_write_file, RAND_file_name - PRNG seed file
  4. =head1 SYNOPSIS
  5. #include <openssl/rand.h>
  6. const char *RAND_file_name(char *buf, size_t num);
  7. int RAND_load_file(const char *filename, long max_bytes);
  8. int RAND_write_file(const char *filename);
  9. =head1 DESCRIPTION
  10. RAND_file_name() generates a default path for the random seed
  11. file. B<buf> points to a buffer of size B<num> in which to store the
  12. filename. The seed file is $RANDFILE if that environment variable is
  13. set, $HOME/.rnd otherwise. If $HOME is not set either, or B<num> is
  14. too small for the path name, an error occurs.
  15. RAND_load_file() reads a number of bytes from file B<filename> and
  16. adds them to the PRNG. If B<max_bytes> is non-negative,
  17. up to to B<max_bytes> are read; starting with OpenSSL 0.9.5,
  18. if B<max_bytes> is -1, the complete file is read.
  19. RAND_write_file() writes a number of random bytes (currently 1024) to
  20. file B<filename> which can be used to initialize the PRNG by calling
  21. RAND_load_file() in a later session.
  22. =head1 RETURN VALUES
  23. RAND_load_file() returns the number of bytes read.
  24. RAND_write_file() returns the number of bytes written, and -1 if the
  25. bytes written were generated without appropriate seed.
  26. RAND_file_name() returns a pointer to B<buf> on success, and NULL on
  27. error.
  28. =head1 SEE ALSO
  29. L<rand(3)|rand(3)>, L<RAND_add(3)|RAND_add(3)>, L<RAND_cleanup(3)|RAND_cleanup(3)>
  30. =head1 HISTORY
  31. RAND_load_file(), RAND_write_file() and RAND_file_name() are available in
  32. all versions of SSLeay and OpenSSL.
  33. =cut