125 lines
4.6 KiB
HTML
125 lines
4.6 KiB
HTML
|
<?xml version="1.0" ?>
|
||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
||
|
<head>
|
||
|
<title>RAND_DRBG_generate</title>
|
||
|
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
|
||
|
<link rev="made" href="mailto:root@localhost" />
|
||
|
</head>
|
||
|
|
||
|
<body style="background-color: white">
|
||
|
|
||
|
|
||
|
<!-- INDEX BEGIN -->
|
||
|
<div name="index">
|
||
|
<p><a name="__index__"></a></p>
|
||
|
|
||
|
<ul>
|
||
|
|
||
|
<li><a href="#name">NAME</a></li>
|
||
|
<li><a href="#synopsis">SYNOPSIS</a></li>
|
||
|
<li><a href="#description">DESCRIPTION</a></li>
|
||
|
<li><a href="#return_values">RETURN VALUES</a></li>
|
||
|
<li><a href="#notes">NOTES</a></li>
|
||
|
<li><a href="#see_also">SEE ALSO</a></li>
|
||
|
<li><a href="#history">HISTORY</a></li>
|
||
|
<li><a href="#copyright">COPYRIGHT</a></li>
|
||
|
</ul>
|
||
|
|
||
|
<hr name="index" />
|
||
|
</div>
|
||
|
<!-- INDEX END -->
|
||
|
|
||
|
<p>
|
||
|
</p>
|
||
|
<hr />
|
||
|
<h1><a name="name">NAME</a></h1>
|
||
|
<p>RAND_DRBG_generate,
|
||
|
RAND_DRBG_bytes
|
||
|
- generate random bytes using the given drbg instance</p>
|
||
|
<p>
|
||
|
</p>
|
||
|
<hr />
|
||
|
<h1><a name="synopsis">SYNOPSIS</a></h1>
|
||
|
<pre>
|
||
|
#include <openssl/rand_drbg.h></pre>
|
||
|
<pre>
|
||
|
int RAND_DRBG_generate(RAND_DRBG *drbg,
|
||
|
unsigned char *out, size_t outlen,
|
||
|
int prediction_resistance,
|
||
|
const unsigned char *adin, size_t adinlen);</pre>
|
||
|
<pre>
|
||
|
int RAND_DRBG_bytes(RAND_DRBG *drbg,
|
||
|
unsigned char *out, size_t outlen);</pre>
|
||
|
<p>
|
||
|
</p>
|
||
|
<hr />
|
||
|
<h1><a name="description">DESCRIPTION</a></h1>
|
||
|
<p><code>RAND_DRBG_generate()</code> generates <strong>outlen</strong> random bytes using the given
|
||
|
DRBG instance <strong>drbg</strong> and stores them in the buffer at <strong>out</strong>.</p>
|
||
|
<p>Before generating the output, the DRBG instance checks whether the maximum
|
||
|
number of generate requests (<em>reseed interval</em>) or the maximum timespan
|
||
|
(<em>reseed time interval</em>) since its last seeding have been reached.
|
||
|
If this is the case, the DRBG reseeds automatically.
|
||
|
Additionally, an immediate reseeding can be requested by setting the
|
||
|
<strong>prediction_resistance</strong> flag to 1.
|
||
|
Requesting prediction resistance is a relative expensive operation.
|
||
|
See NOTES section for more details.</p>
|
||
|
<p>The caller can optionally provide additional data to be used for reseeding
|
||
|
by passing a pointer <strong>adin</strong> to a buffer of length <strong>adinlen</strong>.
|
||
|
This additional data is mixed into the internal state of the random
|
||
|
generator but does not contribute to the entropy count.
|
||
|
The additional data can be omitted by setting <strong>adin</strong> to NULL and
|
||
|
<strong>adinlen</strong> to 0;</p>
|
||
|
<p><code>RAND_DRBG_bytes()</code> generates <strong>outlen</strong> random bytes using the given
|
||
|
DRBG instance <strong>drbg</strong> and stores them in the buffer at <strong>out</strong>.
|
||
|
This function is a wrapper around the <code>RAND_DRBG_generate()</code> call,
|
||
|
which collects some additional data from low entropy sources
|
||
|
(e.g., a high resolution timer) and calls
|
||
|
RAND_DRBG_generate(drbg, out, outlen, 0, adin, adinlen).</p>
|
||
|
<p>
|
||
|
</p>
|
||
|
<hr />
|
||
|
<h1><a name="return_values">RETURN VALUES</a></h1>
|
||
|
<p><code>RAND_DRBG_generate()</code> and <code>RAND_DRBG_bytes()</code> return 1 on success,
|
||
|
and 0 on failure.</p>
|
||
|
<p>
|
||
|
</p>
|
||
|
<hr />
|
||
|
<h1><a name="notes">NOTES</a></h1>
|
||
|
<p>The <em>reseed interval</em> and <em>reseed time interval</em> of the <strong>drbg</strong> are set to
|
||
|
reasonable default values, which in general do not have to be adjusted.
|
||
|
If necessary, they can be changed using <em>RAND_DRBG_set_reseed_interval(3)</em>
|
||
|
and <em>RAND_DRBG_set_reseed_time_interval(3)</em>, respectively.</p>
|
||
|
<p>A request for prediction resistance can only be satisfied by pulling fresh
|
||
|
entropy from a live entropy source (section 5.5.2 of [NIST SP 800-90C]).
|
||
|
It is up to the user to ensure that a live entropy source is configured
|
||
|
and is being used.</p>
|
||
|
<p>
|
||
|
</p>
|
||
|
<hr />
|
||
|
<h1><a name="see_also">SEE ALSO</a></h1>
|
||
|
<p><em>RAND_bytes(3)</em>,
|
||
|
<em>RAND_DRBG_set_reseed_interval(3)</em>,
|
||
|
<em>RAND_DRBG_set_reseed_time_interval(3)</em>,
|
||
|
<em>RAND_DRBG(7)</em></p>
|
||
|
<p>
|
||
|
</p>
|
||
|
<hr />
|
||
|
<h1><a name="history">HISTORY</a></h1>
|
||
|
<p>The RAND_DRBG functions were added in OpenSSL 1.1.1.</p>
|
||
|
<p>Prediction resistance is supported from OpenSSL 3.0.</p>
|
||
|
<p>
|
||
|
</p>
|
||
|
<hr />
|
||
|
<h1><a name="copyright">COPYRIGHT</a></h1>
|
||
|
<p>Copyright 2017-2019 The OpenSSL Project Authors. All Rights Reserved.</p>
|
||
|
<p>Licensed under the Apache License 2.0 (the "License"). You may not use
|
||
|
this file except in compliance with the License. You can obtain a copy
|
||
|
in the file LICENSE in the source distribution or at
|
||
|
<a href="https://www.openssl.org/source/license.html">https://www.openssl.org/source/license.html</a>.</p>
|
||
|
|
||
|
</body>
|
||
|
|
||
|
</html>
|