Home | History | Annotate | Line # | Download | only in man3
      1 =pod
      2 
      3 =head1 NAME
      4 
      5 ossl_rand_get_entropy, ossl_rand_cleanup_entropy,
      6 ossl_rand_get_nonce, ossl_rand_cleanup_nonce
      7 - get seed material from the operating system
      8 
      9 =head1 SYNOPSIS
     10 
     11  #include "crypto/rand.h"
     12 
     13  size_t ossl_rand_get_entropy(OSSL_CORE_HANDLE *handle,
     14                               unsigned char **pout, int entropy,
     15                               size_t min_len, size_t max_len);
     16  void ossl_rand_cleanup_entropy(OSSL_CORE_HANDLE *handle,
     17                                 unsigned char *buf, size_t len);
     18  size_t ossl_rand_get_nonce(OSSL_CORE_HANDLE *handle,
     19                             unsigned char **pout, size_t min_len,
     20                             size_t max_len, const void *salt, size_t salt_len);
     21  void ossl_rand_cleanup_nonce(OSSL_CORE_HANDLE *handle,
     22                               unsigned char *buf, size_t len);
     23 
     24 =head1 DESCRIPTION
     25 
     26 ossl_rand_get_entropy() retrieves seeding material from the operating system.
     27 The seeding material will have at least I<entropy> bytes of randomness and is
     28 stored in a buffer which contains at least I<min_len> and at most I<max_len>
     29 bytes.  The buffer address is stored in I<*pout> and the buffer length is
     30 returned to the caller.
     31 
     32 ossl_rand_cleanup_entropy() cleanses and frees any storage allocated by
     33 ossl_rand_get_entropy().  The seeding buffer is pointed to by I<buf> and is
     34 of length I<len> bytes.
     35 
     36 ossl_rand_get_nonce() retrieves a nonce using the passed I<salt> parameter
     37 of length I<salt_len> and operating system specific information.
     38 The I<salt> should contain uniquely identifying information and this is
     39 included, in an unspecified manner, as part of the output.
     40 The output is stored in a buffer which contains at least I<min_len> and at
     41 most I<max_len> bytes.  The buffer address is stored in I<*pout> and the
     42 buffer length returned to the caller.
     43 
     44 ossl_rand_cleanup_nonce() cleanses and frees any storage allocated by
     45 ossl_rand_get_nonce().  The nonce buffer is pointed to by I<buf> and is
     46 of length I<len> bytes.
     47 
     48 =head1 RETURN VALUES
     49 
     50 ossl_rand_get_entropy() and ossl_rand_get_nonce() return the number of bytes
     51 in I<*pout> or 0 on error.
     52 
     53 =head1 HISTORY
     54 
     55 The functions described here were all added in OpenSSL 3.0.
     56 
     57 =head1 COPYRIGHT
     58 
     59 Copyright 2020 The OpenSSL Project Authors. All Rights Reserved.
     60 
     61 Licensed under the Apache License 2.0 (the "License").  You may not use
     62 this file except in compliance with the License.  You can obtain a copy
     63 in the file LICENSE in the source distribution or at
     64 L<https://www.openssl.org/source/license.html>.
     65 
     66 =cut
     67