1RAND_SET_RAND_METHOD(3)             OpenSSL            RAND_SET_RAND_METHOD(3)
2
3
4

NAME

6       RAND_set_rand_method, RAND_get_rand_method, RAND_OpenSSL - select RAND
7       method
8

SYNOPSIS

10        #include <openssl/rand.h>
11
12        RAND_METHOD *RAND_OpenSSL(void);
13
14        int RAND_set_rand_method(const RAND_METHOD *meth);
15
16        const RAND_METHOD *RAND_get_rand_method(void);
17

DESCRIPTION

19       A RAND_METHOD specifies the functions that OpenSSL uses for random
20       number generation.
21
22       RAND_OpenSSL() returns the default RAND_METHOD implementation by
23       OpenSSL.  This implementation ensures that the PRNG state is unique for
24       each thread.
25
26       If an ENGINE is loaded that provides the RAND API, however, it will be
27       used instead of the method returned by RAND_OpenSSL().
28
29       RAND_set_rand_method() makes meth the method for PRNG use.  If an
30       ENGINE was providing the method, it will be released first.
31
32       RAND_get_rand_method() returns a pointer to the current RAND_METHOD.
33

THE RAND_METHOD STRUCTURE

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, RAND_seed(),
45       RAND_bytes(), internal RAND cleanup, RAND_add(), RAND_pseudo_rand() and
46       RAND_status().  Each pointer may be NULL if the function is not
47       implemented.
48

RETURN VALUES

50       RAND_set_rand_method() returns 1 on success and 0 on failure.
51       RAND_get_rand_method() and RAND_OpenSSL() return pointers to the
52       respective methods.
53

SEE ALSO

55       RAND_bytes(3), ENGINE_by_id(3), RAND(7)
56
58       Copyright 2000-2020 The OpenSSL Project Authors. All Rights Reserved.
59
60       Licensed under the OpenSSL license (the "License").  You may not use
61       this file except in compliance with the License.  You can obtain a copy
62       in the file LICENSE in the source distribution or at
63       <https://www.openssl.org/source/license.html>.
64
65
66
671.1.1q                            2022-07-07           RAND_SET_RAND_METHOD(3)
Impressum