1e71b7053SJung-uk Kim=pod 2e71b7053SJung-uk Kim 3e71b7053SJung-uk Kim=head1 NAME 4e71b7053SJung-uk Kim 5e71b7053SJung-uk KimRAND_set_rand_method, RAND_get_rand_method, RAND_OpenSSL - select RAND method 6e71b7053SJung-uk Kim 7e71b7053SJung-uk Kim=head1 SYNOPSIS 8e71b7053SJung-uk Kim 9e71b7053SJung-uk Kim #include <openssl/rand.h> 10e71b7053SJung-uk Kim 11*b077aed3SPierre ProncheryThe following functions have been deprecated since OpenSSL 3.0, and can be 12*b077aed3SPierre Proncheryhidden entirely by defining B<OPENSSL_API_COMPAT> with a suitable version value, 13*b077aed3SPierre Proncherysee L<openssl_user_macros(7)>: 14*b077aed3SPierre Pronchery 15e71b7053SJung-uk Kim RAND_METHOD *RAND_OpenSSL(void); 16e71b7053SJung-uk Kim 17da327cd2SJung-uk Kim int RAND_set_rand_method(const RAND_METHOD *meth); 18e71b7053SJung-uk Kim 19e71b7053SJung-uk Kim const RAND_METHOD *RAND_get_rand_method(void); 20e71b7053SJung-uk Kim 21e71b7053SJung-uk Kim=head1 DESCRIPTION 22e71b7053SJung-uk Kim 23*b077aed3SPierre ProncheryAll of the functions described on this page are deprecated. 24*b077aed3SPierre ProncheryApplications should instead use L<RAND_set_DRBG_type(3)>, 25*b077aed3SPierre ProncheryL<EVP_RAND(3)> and L<EVP_RAND(7)>. 26*b077aed3SPierre Pronchery 27e71b7053SJung-uk KimA B<RAND_METHOD> specifies the functions that OpenSSL uses for random number 28e71b7053SJung-uk Kimgeneration. 29e71b7053SJung-uk Kim 30e71b7053SJung-uk KimRAND_OpenSSL() returns the default B<RAND_METHOD> implementation by OpenSSL. 31e71b7053SJung-uk KimThis implementation ensures that the PRNG state is unique for each thread. 32e71b7053SJung-uk Kim 33e71b7053SJung-uk KimIf an B<ENGINE> is loaded that provides the RAND API, however, it will 34*b077aed3SPierre Proncherybe used instead of the method returned by RAND_OpenSSL(). This is deprecated 35*b077aed3SPierre Proncheryin OpenSSL 3.0. 36e71b7053SJung-uk Kim 37e71b7053SJung-uk KimRAND_set_rand_method() makes B<meth> the method for PRNG use. If an 38e71b7053SJung-uk KimENGINE was providing the method, it will be released first. 39e71b7053SJung-uk Kim 40e71b7053SJung-uk KimRAND_get_rand_method() returns a pointer to the current B<RAND_METHOD>. 41e71b7053SJung-uk Kim 42e71b7053SJung-uk Kim=head1 THE RAND_METHOD STRUCTURE 43e71b7053SJung-uk Kim 44e71b7053SJung-uk Kim typedef struct rand_meth_st { 45cfac584bSJung-uk Kim int (*seed)(const void *buf, int num); 46e71b7053SJung-uk Kim int (*bytes)(unsigned char *buf, int num); 47e71b7053SJung-uk Kim void (*cleanup)(void); 48cfac584bSJung-uk Kim int (*add)(const void *buf, int num, double entropy); 49e71b7053SJung-uk Kim int (*pseudorand)(unsigned char *buf, int num); 50e71b7053SJung-uk Kim int (*status)(void); 51e71b7053SJung-uk Kim } RAND_METHOD; 52e71b7053SJung-uk Kim 53e71b7053SJung-uk KimThe fields point to functions that are used by, in order, 54e71b7053SJung-uk KimRAND_seed(), RAND_bytes(), internal RAND cleanup, RAND_add(), RAND_pseudo_rand() 55e71b7053SJung-uk Kimand RAND_status(). 56e71b7053SJung-uk KimEach pointer may be NULL if the function is not implemented. 57e71b7053SJung-uk Kim 58e71b7053SJung-uk Kim=head1 RETURN VALUES 59e71b7053SJung-uk Kim 6017f01e99SJung-uk KimRAND_set_rand_method() returns 1 on success and 0 on failure. 61da327cd2SJung-uk KimRAND_get_rand_method() and RAND_OpenSSL() return pointers to the respective 62da327cd2SJung-uk Kimmethods. 63e71b7053SJung-uk Kim 64e71b7053SJung-uk Kim=head1 SEE ALSO 65e71b7053SJung-uk Kim 66*b077aed3SPierre ProncheryL<EVP_RAND(3)>, 67*b077aed3SPierre ProncheryL<RAND_set_DRBG_type(3)>, 68e71b7053SJung-uk KimL<RAND_bytes(3)>, 69e71b7053SJung-uk KimL<ENGINE_by_id(3)>, 70*b077aed3SPierre ProncheryL<EVP_RAND(7)>, 71e71b7053SJung-uk KimL<RAND(7)> 72e71b7053SJung-uk Kim 73*b077aed3SPierre Pronchery=head1 HISTORY 74*b077aed3SPierre Pronchery 75*b077aed3SPierre ProncheryAll of these functions were deprecated in OpenSSL 3.0. 76*b077aed3SPierre Pronchery 77e71b7053SJung-uk Kim=head1 COPYRIGHT 78e71b7053SJung-uk Kim 79*b077aed3SPierre ProncheryCopyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved. 80e71b7053SJung-uk Kim 81*b077aed3SPierre ProncheryLicensed under the Apache License 2.0 (the "License"). You may not use 82e71b7053SJung-uk Kimthis file except in compliance with the License. You can obtain a copy 83e71b7053SJung-uk Kimin the file LICENSE in the source distribution or at 84e71b7053SJung-uk KimL<https://www.openssl.org/source/license.html>. 85e71b7053SJung-uk Kim 86e71b7053SJung-uk Kim=cut 87