Update RAND_load_file return value.
[openssl.git] / doc / man3 / RAND_set_rand_method.pod
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  void 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 Initially, the default B<RAND_METHOD> is the OpenSSL internal implementation,
23 as returned by RAND_OpenSSL().
24 This implementation ensures that the PRNG state is unique for each thread.
25
26 If an B<ENGINE> is loaded that provides the RAND API, however, it will
27 be used instead of the method returned by RAND_OpenSSL().
28
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.
31
32 RAND_get_rand_method() returns a pointer to the current B<RAND_METHOD>.
33
34 =head1 THE RAND_METHOD STRUCTURE
35
36  typedef struct rand_meth_st {
37      void (*seed)(const void *buf, int num);
38      int (*bytes)(unsigned char *buf, int num);
39      void (*cleanup)(void);
40      void (*add)(const void *buf, int num, int randomness);
41      int (*pseudorand)(unsigned char *buf, int num);
42      int (*status)(void);
43  } RAND_METHOD;
44
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()
47 and RAND_status().
48 Each pointer may be NULL if the function is not implemented.
49
50 =head1 RETURN VALUES
51
52 RAND_set_rand_method() returns no value. RAND_get_rand_method() and
53 RAND_OpenSSL() return pointers to the respective methods.
54
55 =head1 SEE ALSO
56
57 L<RAND_bytes(3)>, L<ENGINE_by_id(3)>
58
59 =head1 COPYRIGHT
60
61 Copyright 2000-2017 The OpenSSL Project Authors. All Rights Reserved.
62
63 Licensed under the OpenSSL license (the "License").  You may not use
64 this file except in compliance with the License.  You can obtain a copy
65 in the file LICENSE in the source distribution or at
66 L<https://www.openssl.org/source/license.html>.
67
68 =cut