RAND_set_rand_method.pod 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  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. The following functions have been deprecated since OpenSSL 3.0, and can be
  7. hidden entirely by defining B<OPENSSL_API_COMPAT> with a suitable version value,
  8. see L<openssl_user_macros(7)>:
  9. RAND_METHOD *RAND_OpenSSL(void);
  10. int RAND_set_rand_method(const RAND_METHOD *meth);
  11. const RAND_METHOD *RAND_get_rand_method(void);
  12. =head1 DESCRIPTION
  13. All of the functions described on this page are deprecated.
  14. Applications should instead use L<RAND_set_DRBG_type(3)>,
  15. L<EVP_RAND(3)> and L<EVP_RAND(7)>.
  16. A B<RAND_METHOD> specifies the functions that OpenSSL uses for random number
  17. generation.
  18. RAND_OpenSSL() returns the default B<RAND_METHOD> implementation by OpenSSL.
  19. This implementation ensures that the PRNG state is unique for each thread.
  20. If an B<ENGINE> is loaded that provides the RAND API, however, it will
  21. be used instead of the method returned by RAND_OpenSSL(). This is deprecated
  22. in OpenSSL 3.0.
  23. RAND_set_rand_method() makes B<meth> the method for PRNG use. If an
  24. ENGINE was providing the method, it will be released first.
  25. RAND_get_rand_method() returns a pointer to the current B<RAND_METHOD>.
  26. =head1 THE RAND_METHOD STRUCTURE
  27. typedef struct rand_meth_st {
  28. int (*seed)(const void *buf, int num);
  29. int (*bytes)(unsigned char *buf, int num);
  30. void (*cleanup)(void);
  31. int (*add)(const void *buf, int num, double entropy);
  32. int (*pseudorand)(unsigned char *buf, int num);
  33. int (*status)(void);
  34. } RAND_METHOD;
  35. The fields point to functions that are used by, in order,
  36. RAND_seed(), RAND_bytes(), internal RAND cleanup, RAND_add(), RAND_pseudo_rand()
  37. and RAND_status().
  38. Each pointer may be NULL if the function is not implemented.
  39. =head1 RETURN VALUES
  40. RAND_set_rand_method() returns 1 on success and 0 on failure.
  41. RAND_get_rand_method() and RAND_OpenSSL() return pointers to the respective
  42. methods.
  43. =head1 SEE ALSO
  44. L<EVP_RAND(3)>,
  45. L<RAND_set_DRBG_type(3)>,
  46. L<RAND_bytes(3)>,
  47. L<ENGINE_by_id(3)>,
  48. L<EVP_RAND(7)>,
  49. L<RAND(7)>
  50. =head1 HISTORY
  51. All of these functions were deprecated in OpenSSL 3.0.
  52. =head1 COPYRIGHT
  53. Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved.
  54. Licensed under the Apache License 2.0 (the "License"). You may not use
  55. this file except in compliance with the License. You can obtain a copy
  56. in the file LICENSE in the source distribution or at
  57. L<https://www.openssl.org/source/license.html>.
  58. =cut