2
0

RAND_set_rand_method.pod 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. =pod
  2. =head1 NAME
  3. RAND_set_rand_method, RAND_get_rand_method, RAND_OpenSSL - select RAND method
  4. =head1 SYNOPSIS
  5. #include <openssl/rand.h>
  6. RAND_METHOD *RAND_OpenSSL(void);
  7. void RAND_set_rand_method(const RAND_METHOD *meth);
  8. const RAND_METHOD *RAND_get_rand_method(void);
  9. =head1 DESCRIPTION
  10. A B<RAND_METHOD> specifies the functions that OpenSSL uses for random number
  11. generation.
  12. RAND_OpenSSL() returns the default B<RAND_METHOD> implementation by OpenSSL.
  13. This implementation ensures that the PRNG state is unique for each thread.
  14. If an B<ENGINE> is loaded that provides the RAND API, however, it will
  15. be used instead of the method returned by RAND_OpenSSL().
  16. RAND_set_rand_method() makes B<meth> the method for PRNG use. If an
  17. ENGINE was providing the method, it will be released first.
  18. RAND_get_rand_method() returns a pointer to the current B<RAND_METHOD>.
  19. =head1 THE RAND_METHOD STRUCTURE
  20. typedef struct rand_meth_st {
  21. void (*seed)(const void *buf, int num);
  22. int (*bytes)(unsigned char *buf, int num);
  23. void (*cleanup)(void);
  24. void (*add)(const void *buf, int num, int randomness);
  25. int (*pseudorand)(unsigned char *buf, int num);
  26. int (*status)(void);
  27. } RAND_METHOD;
  28. The fields point to functions that are used by, in order,
  29. RAND_seed(), RAND_bytes(), internal RAND cleanup, RAND_add(), RAND_pseudo_rand()
  30. and RAND_status().
  31. Each pointer may be NULL if the function is not implemented.
  32. =head1 RETURN VALUES
  33. RAND_set_rand_method() returns no value. RAND_get_rand_method() and
  34. RAND_OpenSSL() return pointers to the respective methods.
  35. =head1 SEE ALSO
  36. L<RAND_bytes(3)>,
  37. L<ENGINE_by_id(3)>,
  38. L<RAND(7)>
  39. =head1 COPYRIGHT
  40. Copyright 2000-2018 The OpenSSL Project Authors. All Rights Reserved.
  41. Licensed under the OpenSSL license (the "License"). You may not use
  42. this file except in compliance with the License. You can obtain a copy
  43. in the file LICENSE in the source distribution or at
  44. L<https://www.openssl.org/source/license.html>.
  45. =cut