Blame doc/man3/RAND_set_rand_method.pod

Packit c4476c
=pod
Packit c4476c
Packit c4476c
=head1 NAME
Packit c4476c
Packit c4476c
RAND_set_rand_method, RAND_get_rand_method, RAND_OpenSSL - select RAND method
Packit c4476c
Packit c4476c
=head1 SYNOPSIS
Packit c4476c
Packit c4476c
 #include <openssl/rand.h>
Packit c4476c
Packit c4476c
 RAND_METHOD *RAND_OpenSSL(void);
Packit c4476c
Packit c4476c
 int RAND_set_rand_method(const RAND_METHOD *meth);
Packit c4476c
Packit c4476c
 const RAND_METHOD *RAND_get_rand_method(void);
Packit c4476c
Packit c4476c
=head1 DESCRIPTION
Packit c4476c
Packit c4476c
A B<RAND_METHOD> specifies the functions that OpenSSL uses for random number
Packit c4476c
generation.
Packit c4476c
Packit c4476c
RAND_OpenSSL() returns the default B<RAND_METHOD> implementation by OpenSSL.
Packit c4476c
This implementation ensures that the PRNG state is unique for each thread.
Packit c4476c
Packit c4476c
If an B<ENGINE> is loaded that provides the RAND API, however, it will
Packit c4476c
be used instead of the method returned by RAND_OpenSSL().
Packit c4476c
Packit c4476c
RAND_set_rand_method() makes B<meth> the method for PRNG use.  If an
Packit c4476c
ENGINE was providing the method, it will be released first.
Packit c4476c
Packit c4476c
RAND_get_rand_method() returns a pointer to the current B<RAND_METHOD>.
Packit c4476c
Packit c4476c
=head1 THE RAND_METHOD STRUCTURE
Packit c4476c
Packit c4476c
 typedef struct rand_meth_st {
Packit c4476c
     int (*seed)(const void *buf, int num);
Packit c4476c
     int (*bytes)(unsigned char *buf, int num);
Packit c4476c
     void (*cleanup)(void);
Packit c4476c
     int (*add)(const void *buf, int num, double entropy);
Packit c4476c
     int (*pseudorand)(unsigned char *buf, int num);
Packit c4476c
     int (*status)(void);
Packit c4476c
 } RAND_METHOD;
Packit c4476c
Packit c4476c
The fields point to functions that are used by, in order,
Packit c4476c
RAND_seed(), RAND_bytes(), internal RAND cleanup, RAND_add(), RAND_pseudo_rand()
Packit c4476c
and RAND_status().
Packit c4476c
Each pointer may be NULL if the function is not implemented.
Packit c4476c
Packit c4476c
=head1 RETURN VALUES
Packit c4476c
Packit c4476c
RAND_set_rand_method() returns 1 on success and 0 on failure.
Packit c4476c
RAND_get_rand_method() and RAND_OpenSSL() return pointers to the respective
Packit c4476c
methods.
Packit c4476c
Packit c4476c
=head1 SEE ALSO
Packit c4476c
Packit c4476c
L<RAND_bytes(3)>,
Packit c4476c
L<ENGINE_by_id(3)>,
Packit c4476c
L<RAND(7)>
Packit c4476c
Packit c4476c
=head1 COPYRIGHT
Packit c4476c
Packit c4476c
Copyright 2000-2020 The OpenSSL Project Authors. All Rights Reserved.
Packit c4476c
Packit c4476c
Licensed under the OpenSSL license (the "License").  You may not use
Packit c4476c
this file except in compliance with the License.  You can obtain a copy
Packit c4476c
in the file LICENSE in the source distribution or at
Packit c4476c
L<https://www.openssl.org/source/license.html>.
Packit c4476c
Packit c4476c
=cut