]> git.ipfire.org Git - thirdparty/openssl.git/blame - doc/man3/RAND_set_rand_method.pod
Implement EVP_MAC_do_all_ex()
[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
04256277
RS
11 RAND_METHOD *RAND_OpenSSL(void);
12
5fe6e231 13 int RAND_set_rand_method(const RAND_METHOD *meth);
60b52453 14
5bf73873 15 const RAND_METHOD *RAND_get_rand_method(void);
60b52453 16
60b52453
UM
17=head1 DESCRIPTION
18
5bf73873 19A B<RAND_METHOD> specifies the functions that OpenSSL uses for random number
04256277 20generation.
60b52453 21
a73d990e 22RAND_OpenSSL() returns the default B<RAND_METHOD> implementation by OpenSSL.
04256277 23This implementation ensures that the PRNG state is unique for each thread.
5bf73873 24
04256277
RS
25If an B<ENGINE> is loaded that provides the RAND API, however, it will
26be used instead of the method returned by RAND_OpenSSL().
5bf73873 27
04256277
RS
28RAND_set_rand_method() makes B<meth> the method for PRNG use. If an
29ENGINE was providing the method, it will be released first.
30
31RAND_get_rand_method() returns a pointer to the current B<RAND_METHOD>.
60b52453 32
e93f9a32 33=head1 THE RAND_METHOD STRUCTURE
60b52453 34
04256277 35 typedef struct rand_meth_st {
2947af32
BB
36 void (*seed)(const void *buf, int num);
37 int (*bytes)(unsigned char *buf, int num);
38 void (*cleanup)(void);
f367ac2b 39 void (*add)(const void *buf, int num, int randomness);
2947af32
BB
40 int (*pseudorand)(unsigned char *buf, int num);
41 int (*status)(void);
60b52453
UM
42 } RAND_METHOD;
43
04256277 44The fields point to functions that are used by, in order,
974eeb93 45RAND_seed(), RAND_bytes(), internal RAND cleanup, RAND_add(), RAND_pseudo_rand()
7f112099 46and RAND_status().
04256277 47Each pointer may be NULL if the function is not implemented.
60b52453
UM
48
49=head1 RETURN VALUES
50
5fe6e231 51RAND_set_rand_method() returns 1 on success and 0 on failue.
52RAND_get_rand_method() and RAND_OpenSSL() return pointers to the respective
53methods.
60b52453
UM
54
55=head1 SEE ALSO
56
a73d990e
DMSP
57L<RAND_bytes(3)>,
58L<ENGINE_by_id(3)>,
59L<RAND(7)>
60b52453 60
e2f92610
RS
61=head1 COPYRIGHT
62
a73d990e 63Copyright 2000-2018 The OpenSSL Project Authors. All Rights Reserved.
e2f92610 64
4746f25a 65Licensed under the Apache License 2.0 (the "License"). You may not use
e2f92610
RS
66this file except in compliance with the License. You can obtain a copy
67in the file LICENSE in the source distribution or at
68L<https://www.openssl.org/source/license.html>.
69
70=cut