Doc nits cleanup, round 2
[openssl.git] / doc / crypto / rand.pod
1 =pod
2
3 =head1 NAME
4
5 rand - pseudo-random number generator
6
7 =head1 SYNOPSIS
8
9  #include <openssl/rand.h>
10
11  int  RAND_set_rand_engine(ENGINE *engine);
12
13  int  RAND_bytes(unsigned char *buf, int num);
14  int  RAND_pseudo_bytes(unsigned char *buf, int num);
15
16  void RAND_seed(const void *buf, int num);
17  void RAND_add(const void *buf, int num, int entropy);
18  int  RAND_status(void);
19
20  int  RAND_load_file(const char *file, long max_bytes);
21  int  RAND_write_file(const char *file);
22  const char *RAND_file_name(char *file, size_t num);
23
24  int  RAND_egd(const char *path);
25
26  void RAND_set_rand_method(const RAND_METHOD *meth);
27  const RAND_METHOD *RAND_get_rand_method(void);
28  RAND_METHOD *RAND_OpenSSL(void);
29
30  /* For Win32 only */
31  void RAND_screen(void);
32  int RAND_event(UINT, WPARAM, LPARAM);
33
34 Deprecated:
35
36  #if OPENSSL_API_COMPAT < 0x10100000L
37  void RAND_cleanup(void)
38  #endif
39
40 =head1 DESCRIPTION
41
42 Since the introduction of the ENGINE API, the recommended way of controlling
43 default implementations is by using the ENGINE API functions. The default
44 B<RAND_METHOD>, as set by RAND_set_rand_method() and returned by
45 RAND_get_rand_method(), is only used if no ENGINE has been set as the default
46 "rand" implementation. Hence, these two functions are no longer the recommended
47 way to control defaults.
48
49 If an alternative B<RAND_METHOD> implementation is being used (either set
50 directly or as provided by an ENGINE module), then it is entirely responsible
51 for the generation and management of a cryptographically secure PRNG stream. The
52 mechanisms described below relate solely to the software PRNG implementation
53 built in to OpenSSL and used by default.
54
55 These functions implement a cryptographically secure pseudo-random
56 number generator (PRNG). It is used by other library functions for
57 example to generate random keys, and applications can use it when they
58 need randomness.
59
60 A cryptographic PRNG must be seeded with unpredictable data such as
61 mouse movements or keys pressed at random by the user. This is
62 described in L<RAND_add(3)>. Its state can be saved in a seed file
63 (see L<RAND_load_file(3)>) to avoid having to go through the
64 seeding process whenever the application is started.
65
66 L<RAND_bytes(3)> describes how to obtain random data from the
67 PRNG.
68
69 =head1 SEE ALSO
70
71 L<BN_rand(3)>, L<RAND_add(3)>,
72 L<RAND_load_file(3)>, L<RAND_egd(3)>,
73 L<RAND_bytes(3)>,
74 L<RAND_set_rand_method(3)>,
75 L<RAND_cleanup(3)>
76
77 =head1 COPYRIGHT
78
79 Copyright 2000-2016 The OpenSSL Project Authors. All Rights Reserved.
80
81 Licensed under the OpenSSL license (the "License").  You may not use
82 this file except in compliance with the License.  You can obtain a copy
83 in the file LICENSE in the source distribution or at
84 L<https://www.openssl.org/source/license.html>.
85
86 =cut