]> git.ipfire.org Git - thirdparty/openssl.git/blame - doc/man3/RAND_set_rand_method.pod
Clarify the deprecation warnings in the docs
[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
3dbf8243
MC
11The following functions have been deprecated since OpenSSL 3.0, and can be
12hidden entirely by defining B<OPENSSL_API_COMPAT> with a suitable version value,
13see L<openssl_user_macros(7)>:
ac60c84f 14
04256277
RS
15 RAND_METHOD *RAND_OpenSSL(void);
16
5fe6e231 17 int RAND_set_rand_method(const RAND_METHOD *meth);
60b52453 18
5bf73873 19 const RAND_METHOD *RAND_get_rand_method(void);
60b52453 20
60b52453
UM
21=head1 DESCRIPTION
22
ac60c84f
P
23All of the functions described on this page are deprecated.
24Applications should instead use L<RAND_set_DRBG_type(3)>,
25L<EVP_RAND(3)> and L<EVP_RAND(7)>.
26
5bf73873 27A B<RAND_METHOD> specifies the functions that OpenSSL uses for random number
04256277 28generation.
60b52453 29
a73d990e 30RAND_OpenSSL() returns the default B<RAND_METHOD> implementation by OpenSSL.
04256277 31This implementation ensures that the PRNG state is unique for each thread.
5bf73873 32
04256277 33If an B<ENGINE> is loaded that provides the RAND API, however, it will
8b4c89f8
P
34be used instead of the method returned by RAND_OpenSSL(). This is deprecated
35in OpenSSL 3.0.
5bf73873 36
04256277
RS
37RAND_set_rand_method() makes B<meth> the method for PRNG use. If an
38ENGINE was providing the method, it will be released first.
39
40RAND_get_rand_method() returns a pointer to the current B<RAND_METHOD>.
60b52453 41
e93f9a32 42=head1 THE RAND_METHOD STRUCTURE
60b52453 43
04256277 44 typedef struct rand_meth_st {
ae325428 45 int (*seed)(const void *buf, int num);
2947af32
BB
46 int (*bytes)(unsigned char *buf, int num);
47 void (*cleanup)(void);
ae325428 48 int (*add)(const void *buf, int num, double entropy);
2947af32
BB
49 int (*pseudorand)(unsigned char *buf, int num);
50 int (*status)(void);
60b52453
UM
51 } RAND_METHOD;
52
04256277 53The fields point to functions that are used by, in order,
974eeb93 54RAND_seed(), RAND_bytes(), internal RAND cleanup, RAND_add(), RAND_pseudo_rand()
7f112099 55and RAND_status().
04256277 56Each pointer may be NULL if the function is not implemented.
60b52453
UM
57
58=head1 RETURN VALUES
59
79c44b4e 60RAND_set_rand_method() returns 1 on success and 0 on failure.
5fe6e231 61RAND_get_rand_method() and RAND_OpenSSL() return pointers to the respective
62methods.
60b52453
UM
63
64=head1 SEE ALSO
65
ac60c84f
P
66L<EVP_RAND(3)>,
67L<RAND_set_DRBG_type(3)>,
a73d990e
DMSP
68L<RAND_bytes(3)>,
69L<ENGINE_by_id(3)>,
ac60c84f 70L<EVP_RAND(7)>,
a73d990e 71L<RAND(7)>
60b52453 72
8b4c89f8
P
73=head1 HISTORY
74
ac60c84f 75All of these functions were deprecated in OpenSSL 3.0.
8b4c89f8 76
e2f92610
RS
77=head1 COPYRIGHT
78
8020d79b 79Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved.
e2f92610 80
4746f25a 81Licensed under the Apache License 2.0 (the "License"). You may not use
e2f92610
RS
82this file except in compliance with the License. You can obtain a copy
83in the file LICENSE in the source distribution or at
84L<https://www.openssl.org/source/license.html>.
85
86=cut