139 lines
5.6 KiB
HTML
Executable File
139 lines
5.6 KiB
HTML
Executable File
<?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_add</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="#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_add, RAND_poll, RAND_seed, RAND_status, RAND_event, RAND_screen,
|
|
RAND_keep_random_devices_open
|
|
- add randomness to the PRNG or get its status</p>
|
|
<p>
|
|
</p>
|
|
<hr />
|
|
<h1><a name="synopsis">SYNOPSIS</a></h1>
|
|
<pre>
|
|
#include <openssl/rand.h></pre>
|
|
<pre>
|
|
int RAND_status(void);
|
|
int RAND_poll();</pre>
|
|
<pre>
|
|
void RAND_add(const void *buf, int num, double randomness);
|
|
void RAND_seed(const void *buf, int num);</pre>
|
|
<pre>
|
|
void RAND_keep_random_devices_open(int keep);</pre>
|
|
<p>Deprecated since OpenSSL 1.1.0, can be hidden entirely by defining
|
|
<strong>OPENSSL_API_COMPAT</strong> with a suitable version value, see
|
|
<em>openssl_user_macros(7)</em>:</p>
|
|
<pre>
|
|
int RAND_event(UINT iMsg, WPARAM wParam, LPARAM lParam);
|
|
void RAND_screen(void);</pre>
|
|
<p>
|
|
</p>
|
|
<hr />
|
|
<h1><a name="description">DESCRIPTION</a></h1>
|
|
<p>These functions can be used to seed the random generator and to check its
|
|
seeded state.
|
|
In general, manual (re-)seeding of the default OpenSSL random generator
|
|
(<em>RAND_OpenSSL(3)</em>) is not necessary (but allowed), since it does (re-)seed
|
|
itself automatically using trusted system entropy sources.
|
|
This holds unless the default RAND_METHOD has been replaced or OpenSSL was
|
|
built with automatic reseeding disabled, see <em>RAND(7)</em> for more details.</p>
|
|
<p><code>RAND_status()</code> indicates whether or not the random generator has been sufficiently
|
|
seeded. If not, functions such as <em>RAND_bytes(3)</em> will fail.</p>
|
|
<p><code>RAND_poll()</code> uses the system's capabilities to seed the random generator using
|
|
random input obtained from polling various trusted entropy sources.
|
|
The default choice of the entropy source can be modified at build time,
|
|
see <em>RAND(7)</em> for more details.</p>
|
|
<p><code>RAND_add()</code> mixes the <strong>num</strong> bytes at <strong>buf</strong> into the internal state
|
|
of the random generator.
|
|
This function will not normally be needed, as mentioned above.
|
|
The <strong>randomness</strong> argument is an estimate of how much randomness is
|
|
contained in
|
|
<strong>buf</strong>, in bytes, and should be a number between zero and <strong>num</strong>.
|
|
Details about sources of randomness and how to estimate their randomness
|
|
can be found in the literature; for example [NIST SP 800-90B].
|
|
The content of <strong>buf</strong> cannot be recovered from subsequent random generator output.
|
|
Applications that intend to save and restore random state in an external file
|
|
should consider using <em>RAND_load_file(3)</em> instead.</p>
|
|
<p>NOTE: In FIPS mode, random data provided by the application is not considered to
|
|
be a trusted entropy source. It is mixed into the internal state of the RNG as
|
|
additional data only and this does not count as a full reseed.
|
|
For more details, see <em>RAND_DRBG(7)</em>.</p>
|
|
<p><code>RAND_seed()</code> is equivalent to <code>RAND_add()</code> with <strong>randomness</strong> set to <strong>num</strong>.</p>
|
|
<p><code>RAND_keep_random_devices_open()</code> is used to control file descriptor
|
|
usage by the random seed sources. Some seed sources maintain open file
|
|
descriptors by default, which allows such sources to operate in a
|
|
<code>chroot(2)</code> jail without the associated device nodes being available. When
|
|
the <strong>keep</strong> argument is zero, this call disables the retention of file
|
|
descriptors. Conversely, a nonzero argument enables the retention of
|
|
file descriptors. This function is usually called during initialization
|
|
and it takes effect immediately.</p>
|
|
<p><code>RAND_event()</code> and <code>RAND_screen()</code> are equivalent to <code>RAND_poll()</code> and exist
|
|
for compatibility reasons only. See HISTORY section below.</p>
|
|
<p>
|
|
</p>
|
|
<hr />
|
|
<h1><a name="return_values">RETURN VALUES</a></h1>
|
|
<p><code>RAND_status()</code> returns 1 if the random generator has been seeded
|
|
with enough data, 0 otherwise.</p>
|
|
<p><code>RAND_poll()</code> returns 1 if it generated seed data, 0 otherwise.</p>
|
|
<p><code>RAND_event()</code> returns <code>RAND_status()</code>.</p>
|
|
<p>The other functions do not return values.</p>
|
|
<p>
|
|
</p>
|
|
<hr />
|
|
<h1><a name="see_also">SEE ALSO</a></h1>
|
|
<p><em>RAND_bytes(3)</em>,
|
|
<em>RAND_egd(3)</em>,
|
|
<em>RAND_load_file(3)</em>,
|
|
<em>RAND(7)</em>
|
|
<em>RAND_DRBG(7)</em></p>
|
|
<p>
|
|
</p>
|
|
<hr />
|
|
<h1><a name="history">HISTORY</a></h1>
|
|
<p><code>RAND_event()</code> and <code>RAND_screen()</code> were deprecated in OpenSSL 1.1.0 and should
|
|
not be used.</p>
|
|
<p>
|
|
</p>
|
|
<hr />
|
|
<h1><a name="copyright">COPYRIGHT</a></h1>
|
|
<p>Copyright 2000-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>
|