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