1RAND_SET_RAND_METHOD(3ossl)         OpenSSL        RAND_SET_RAND_METHOD(3ossl)
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       The following functions have been deprecated since OpenSSL 3.0, and can
13       be hidden entirely by defining OPENSSL_API_COMPAT with a suitable
14       version value, see openssl_user_macros(7):
15
16        RAND_METHOD *RAND_OpenSSL(void);
17
18        int RAND_set_rand_method(const RAND_METHOD *meth);
19
20        const RAND_METHOD *RAND_get_rand_method(void);
21

DESCRIPTION

23       All of the functions described on this page are deprecated.
24       Applications should instead use RAND_set_DRBG_type(3), EVP_RAND(3) and
25       EVP_RAND(7).
26
27       A RAND_METHOD specifies the functions that OpenSSL uses for random
28       number generation.
29
30       RAND_OpenSSL() returns the default RAND_METHOD implementation by
31       OpenSSL.  This implementation ensures that the PRNG state is unique for
32       each thread.
33
34       If an ENGINE is loaded that provides the RAND API, however, it will be
35       used instead of the method returned by RAND_OpenSSL().  This is
36       deprecated in OpenSSL 3.0.
37
38       RAND_set_rand_method() makes meth the method for PRNG use.  If an
39       ENGINE was providing the method, it will be released first.
40
41       RAND_get_rand_method() returns a pointer to the current RAND_METHOD.
42

THE RAND_METHOD STRUCTURE

44        typedef struct rand_meth_st {
45            int (*seed)(const void *buf, int num);
46            int (*bytes)(unsigned char *buf, int num);
47            void (*cleanup)(void);
48            int (*add)(const void *buf, int num, double entropy);
49            int (*pseudorand)(unsigned char *buf, int num);
50            int (*status)(void);
51        } RAND_METHOD;
52
53       The fields point to functions that are used by, in order, RAND_seed(),
54       RAND_bytes(), internal RAND cleanup, RAND_add(), RAND_pseudo_rand() and
55       RAND_status().  Each pointer may be NULL if the function is not
56       implemented.
57

RETURN VALUES

59       RAND_set_rand_method() returns 1 on success and 0 on failure.
60       RAND_get_rand_method() and RAND_OpenSSL() return pointers to the
61       respective methods.
62

SEE ALSO

64       EVP_RAND(3), RAND_set_DRBG_type(3), RAND_bytes(3), ENGINE_by_id(3),
65       EVP_RAND(7), RAND(7)
66

HISTORY

68       All of these functions were deprecated in OpenSSL 3.0.
69
71       Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved.
72
73       Licensed under the Apache License 2.0 (the "License").  You may not use
74       this file except in compliance with the License.  You can obtain a copy
75       in the file LICENSE in the source distribution or at
76       <https://www.openssl.org/source/license.html>.
77
78
79
803.0.9                             2023-07-27       RAND_SET_RAND_METHOD(3ossl)
Impressum