5 RAND_set_rand_method, RAND_get_rand_method, RAND_OpenSSL - select RAND method
9 #include <openssl/rand.h>
11 RAND_METHOD *RAND_OpenSSL(void);
13 int RAND_set_rand_method(const RAND_METHOD *meth);
15 const RAND_METHOD *RAND_get_rand_method(void);
19 A B<RAND_METHOD> specifies the functions that OpenSSL uses for random number
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.
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(). This is deprecated
29 RAND_set_rand_method() makes B<meth> the method for PRNG use. If an
30 ENGINE was providing the method, it will be released first.
32 RAND_get_rand_method() returns a pointer to the current B<RAND_METHOD>.
34 =head1 THE RAND_METHOD STRUCTURE
36 typedef struct rand_meth_st {
37 int (*seed)(const void *buf, int num);
38 int (*bytes)(unsigned char *buf, int num);
39 void (*cleanup)(void);
40 int (*add)(const void *buf, int num, double entropy);
41 int (*pseudorand)(unsigned char *buf, int num);
45 The fields point to functions that are used by, in order,
46 RAND_seed(), RAND_bytes(), internal RAND cleanup, RAND_add(), RAND_pseudo_rand()
48 Each pointer may be NULL if the function is not implemented.
52 RAND_set_rand_method() returns 1 on success and 0 on failure.
53 RAND_get_rand_method() and RAND_OpenSSL() return pointers to the respective
64 The ability for an B<ENGINE> to replace the RAND API was deprecated in
69 Copyright 2000-2020 The OpenSSL Project Authors. All Rights Reserved.
71 Licensed under the Apache License 2.0 (the "License"). You may not use
72 this file except in compliance with the License. You can obtain a copy
73 in the file LICENSE in the source distribution or at
74 L<https://www.openssl.org/source/license.html>.