1RAND_SET_RAND_METHOD(3) OpenSSL RAND_SET_RAND_METHOD(3)
2
3
4
6 RAND_set_rand_method, RAND_get_rand_method, RAND_OpenSSL - select RAND
7 method
8
10 #include <openssl/rand.h>
11
12 RAND_METHOD *RAND_OpenSSL(void);
13
14 void RAND_set_rand_method(const RAND_METHOD *meth);
15
16 const RAND_METHOD *RAND_get_rand_method(void);
17
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
35 typedef struct rand_meth_st {
36 void (*seed)(const void *buf, int num);
37 int (*bytes)(unsigned char *buf, int num);
38 void (*cleanup)(void);
39 void (*add)(const void *buf, int num, int randomness);
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
50 RAND_set_rand_method() returns no value. RAND_get_rand_method() and
51 RAND_OpenSSL() return pointers to the respective methods.
52
54 RAND_bytes(3), ENGINE_by_id(3), RAND(7)
55
57 Copyright 2000-2018 The OpenSSL Project Authors. All Rights Reserved.
58
59 Licensed under the OpenSSL license (the "License"). You may not use
60 this file except in compliance with the License. You can obtain a copy
61 in the file LICENSE in the source distribution or at
62 <https://www.openssl.org/source/license.html>.
63
64
65
661.1.1 2018-09-11 RAND_SET_RAND_METHOD(3)