]> git.ipfire.org Git - thirdparty/openssl.git/blame - doc/man3/RAND_set_rand_method.pod
Fix referenses in section 3 manuals
[thirdparty/openssl.git] / doc / man3 / RAND_set_rand_method.pod
CommitLineData
60b52453
UM
1=pod
2
3=head1 NAME
4
b0700d2c 5RAND_set_rand_method, RAND_get_rand_method, RAND_OpenSSL - select RAND method
60b52453
UM
6
7=head1 SYNOPSIS
8
9 #include <openssl/rand.h>
10
5bf73873 11 void RAND_set_rand_method(const RAND_METHOD *meth);
60b52453 12
5bf73873 13 const RAND_METHOD *RAND_get_rand_method(void);
60b52453 14
b0700d2c 15 RAND_METHOD *RAND_OpenSSL(void);
60b52453
UM
16
17=head1 DESCRIPTION
18
5bf73873
GT
19A B<RAND_METHOD> specifies the functions that OpenSSL uses for random number
20generation. By modifying the method, alternative implementations such as
21hardware RNGs may be used. IMPORTANT: See the NOTES section for important
22information about how these RAND API functions are affected by the use of
23B<ENGINE> API calls.
60b52453 24
5bf73873 25Initially, the default RAND_METHOD is the OpenSSL internal implementation, as
b0700d2c 26returned by RAND_OpenSSL().
5bf73873
GT
27
28RAND_set_default_method() makes B<meth> the method for PRNG use. B<NB>: This is
29true only whilst no ENGINE has been set as a default for RAND, so this function
30is no longer recommended.
31
32RAND_get_default_method() returns a pointer to the current RAND_METHOD.
b6a338cb 33However, the meaningfulness of this result is dependent on whether the ENGINE
5bf73873 34API is being used, so this function is no longer recommended.
60b52453 35
e93f9a32 36=head1 THE RAND_METHOD STRUCTURE
60b52453
UM
37
38 typedef struct rand_meth_st
39 {
40 void (*seed)(const void *buf, int num);
41 int (*bytes)(unsigned char *buf, int num);
42 void (*cleanup)(void);
43 void (*add)(const void *buf, int num, int entropy);
44 int (*pseudorand)(unsigned char *buf, int num);
1bc74519 45 int (*status)(void);
60b52453
UM
46 } RAND_METHOD;
47
974eeb93
MC
48The components point to method implementations used by (or called by), in order,
49RAND_seed(), RAND_bytes(), internal RAND cleanup, RAND_add(), RAND_pseudo_rand()
7f112099 50and RAND_status().
60b52453
UM
51Each component may be NULL if the function is not implemented.
52
53=head1 RETURN VALUES
54
55RAND_set_rand_method() returns no value. RAND_get_rand_method() and
b0700d2c 56RAND_OpenSSL() return pointers to the respective methods.
60b52453 57
5bf73873
GT
58=head1 NOTES
59
a528d4f0 60RAND_METHOD implementations are grouped together with other
5bf73873
GT
61algorithmic APIs (eg. RSA_METHOD, EVP_CIPHER, etc) in B<ENGINE> modules. If a
62default ENGINE is specified for RAND functionality using an ENGINE API function,
63that will override any RAND defaults set using the RAND API (ie.
64RAND_set_rand_method()). For this reason, the ENGINE API is the recommended way
65to control default implementations for use in RAND and other cryptographic
66algorithms.
67
60b52453
UM
68=head1 SEE ALSO
69
b97fdb57 70L<RAND_bytes(3)>, L<ENGINE_by_id(3)>
60b52453 71
e2f92610
RS
72=head1 COPYRIGHT
73
74Copyright 2000-2016 The OpenSSL Project Authors. All Rights Reserved.
75
76Licensed under the OpenSSL license (the "License"). You may not use
77this file except in compliance with the License. You can obtain a copy
78in the file LICENSE in the source distribution or at
79L<https://www.openssl.org/source/license.html>.
80
81=cut