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