]>
Commit | Line | Data |
---|---|---|
60b52453 UM |
1 | =pod |
2 | ||
3 | =head1 NAME | |
4 | ||
b0700d2c | 5 | RAND_set_rand_method, RAND_get_rand_method, RAND_OpenSSL - select RAND method |
60b52453 UM |
6 | |
7 | =head1 SYNOPSIS | |
8 | ||
9 | #include <openssl/rand.h> | |
10 | ||
3dbf8243 MC |
11 | The following functions have been deprecated since OpenSSL 3.0, and can be |
12 | hidden entirely by defining B<OPENSSL_API_COMPAT> with a suitable version value, | |
13 | see L<openssl_user_macros(7)>: | |
ac60c84f | 14 | |
04256277 RS |
15 | RAND_METHOD *RAND_OpenSSL(void); |
16 | ||
5fe6e231 | 17 | int RAND_set_rand_method(const RAND_METHOD *meth); |
60b52453 | 18 | |
5bf73873 | 19 | const RAND_METHOD *RAND_get_rand_method(void); |
60b52453 | 20 | |
60b52453 UM |
21 | =head1 DESCRIPTION |
22 | ||
ac60c84f P |
23 | All of the functions described on this page are deprecated. |
24 | Applications should instead use L<RAND_set_DRBG_type(3)>, | |
25 | L<EVP_RAND(3)> and L<EVP_RAND(7)>. | |
26 | ||
5bf73873 | 27 | A B<RAND_METHOD> specifies the functions that OpenSSL uses for random number |
04256277 | 28 | generation. |
60b52453 | 29 | |
a73d990e | 30 | RAND_OpenSSL() returns the default B<RAND_METHOD> implementation by OpenSSL. |
04256277 | 31 | This implementation ensures that the PRNG state is unique for each thread. |
5bf73873 | 32 | |
04256277 | 33 | If an B<ENGINE> is loaded that provides the RAND API, however, it will |
8b4c89f8 P |
34 | be used instead of the method returned by RAND_OpenSSL(). This is deprecated |
35 | in OpenSSL 3.0. | |
5bf73873 | 36 | |
04256277 RS |
37 | RAND_set_rand_method() makes B<meth> the method for PRNG use. If an |
38 | ENGINE was providing the method, it will be released first. | |
39 | ||
40 | RAND_get_rand_method() returns a pointer to the current B<RAND_METHOD>. | |
60b52453 | 41 | |
e93f9a32 | 42 | =head1 THE RAND_METHOD STRUCTURE |
60b52453 | 43 | |
04256277 | 44 | typedef struct rand_meth_st { |
ae325428 | 45 | int (*seed)(const void *buf, int num); |
2947af32 BB |
46 | int (*bytes)(unsigned char *buf, int num); |
47 | void (*cleanup)(void); | |
ae325428 | 48 | int (*add)(const void *buf, int num, double entropy); |
2947af32 BB |
49 | int (*pseudorand)(unsigned char *buf, int num); |
50 | int (*status)(void); | |
60b52453 UM |
51 | } RAND_METHOD; |
52 | ||
04256277 | 53 | The fields point to functions that are used by, in order, |
974eeb93 | 54 | RAND_seed(), RAND_bytes(), internal RAND cleanup, RAND_add(), RAND_pseudo_rand() |
7f112099 | 55 | and RAND_status(). |
04256277 | 56 | Each pointer may be NULL if the function is not implemented. |
60b52453 UM |
57 | |
58 | =head1 RETURN VALUES | |
59 | ||
79c44b4e | 60 | RAND_set_rand_method() returns 1 on success and 0 on failure. |
5fe6e231 | 61 | RAND_get_rand_method() and RAND_OpenSSL() return pointers to the respective |
62 | methods. | |
60b52453 UM |
63 | |
64 | =head1 SEE ALSO | |
65 | ||
ac60c84f P |
66 | L<EVP_RAND(3)>, |
67 | L<RAND_set_DRBG_type(3)>, | |
a73d990e DMSP |
68 | L<RAND_bytes(3)>, |
69 | L<ENGINE_by_id(3)>, | |
ac60c84f | 70 | L<EVP_RAND(7)>, |
a73d990e | 71 | L<RAND(7)> |
60b52453 | 72 | |
8b4c89f8 P |
73 | =head1 HISTORY |
74 | ||
ac60c84f | 75 | All of these functions were deprecated in OpenSSL 3.0. |
8b4c89f8 | 76 | |
e2f92610 RS |
77 | =head1 COPYRIGHT |
78 | ||
8020d79b | 79 | Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved. |
e2f92610 | 80 | |
4746f25a | 81 | Licensed under the Apache License 2.0 (the "License"). You may not use |
e2f92610 RS |
82 | this file except in compliance with the License. You can obtain a copy |
83 | in the file LICENSE in the source distribution or at | |
84 | L<https://www.openssl.org/source/license.html>. | |
85 | ||
86 | =cut |