diff options
Diffstat (limited to 'static/freebsd/man9/random.9 4.html')
| -rw-r--r-- | static/freebsd/man9/random.9 4.html | 160 |
1 files changed, 0 insertions, 160 deletions
diff --git a/static/freebsd/man9/random.9 4.html b/static/freebsd/man9/random.9 4.html deleted file mode 100644 index dea2d113..00000000 --- a/static/freebsd/man9/random.9 4.html +++ /dev/null @@ -1,160 +0,0 @@ -<table class="head"> - <tr> - <td class="head-ltitle">RANDOM(9)</td> - <td class="head-vol">Kernel Developer's Manual</td> - <td class="head-rtitle">RANDOM(9)</td> - </tr> -</table> -<div class="manual-text"> -<section class="Sh"> -<h1 class="Sh" id="NAME"><a class="permalink" href="#NAME">NAME</a></h1> -<p class="Pp"><code class="Nm">arc4rand</code>, - <code class="Nm">arc4random</code>, <code class="Nm">arc4random_buf</code>, - <code class="Nm">is_random_seeded</code>, <code class="Nm">random</code>, - <code class="Nm">read_random</code>, <code class="Nm">read_random_uio</code> - — <span class="Nd">supply pseudo-random numbers</span></p> -</section> -<section class="Sh"> -<h1 class="Sh" id="SYNOPSIS"><a class="permalink" href="#SYNOPSIS">SYNOPSIS</a></h1> -<p class="Pp"><code class="In">#include - <<a class="In">sys/libkern.h</a>></code></p> -<p class="Pp"><var class="Ft">uint32_t</var> - <br/> - <code class="Fn">arc4random</code>(<var class="Fa" style="white-space: nowrap;">void</var>);</p> -<p class="Pp"><var class="Ft">void</var> - <br/> - <code class="Fn">arc4random_buf</code>(<var class="Fa" style="white-space: nowrap;">void - *ptr</var>, <var class="Fa" style="white-space: nowrap;">size_t - len</var>);</p> -<p class="Pp"><var class="Ft">void</var> - <br/> - <code class="Fn">arc4rand</code>(<var class="Fa" style="white-space: nowrap;">void - *ptr</var>, <var class="Fa" style="white-space: nowrap;">u_int length</var>, - <var class="Fa" style="white-space: nowrap;">int reseed</var>);</p> -<p class="Pp"> - <br/> - <code class="In">#include <<a class="In">sys/random.h</a>></code></p> -<p class="Pp"><var class="Ft">bool</var> - <br/> - <code class="Fn">is_random_seeded</code>(<var class="Fa" style="white-space: nowrap;">void</var>);</p> -<p class="Pp"><var class="Ft">void</var> - <br/> - <code class="Fn">read_random</code>(<var class="Fa" style="white-space: nowrap;">void - *buffer</var>, <var class="Fa" style="white-space: nowrap;">int - count</var>);</p> -<p class="Pp"><var class="Ft">int</var> - <br/> - <code class="Fn">read_random_uio</code>(<var class="Fa" style="white-space: nowrap;">struct - uio *uio</var>, <var class="Fa" style="white-space: nowrap;">bool - nonblock</var>);</p> -<section class="Ss"> -<h2 class="Ss" id="LEGACY_ROUTINES"><a class="permalink" href="#LEGACY_ROUTINES">LEGACY - ROUTINES</a></h2> -<p class="Pp"><code class="In">#include - <<a class="In">sys/libkern.h</a>></code></p> -<p class="Pp"><var class="Ft">u_long</var> - <br/> - <code class="Fn">random</code>(<var class="Fa" style="white-space: nowrap;">void</var>);</p> -</section> -</section> -<section class="Sh"> -<h1 class="Sh" id="DESCRIPTION"><a class="permalink" href="#DESCRIPTION">DESCRIPTION</a></h1> -<p class="Pp">The - <a class="permalink" href="#arc4random"><code class="Fn" id="arc4random">arc4random</code></a>() - and - <a class="permalink" href="#arc4random_buf"><code class="Fn" id="arc4random_buf">arc4random_buf</code></a>() - functions will return very good quality random numbers, suited for - security-related purposes. Both are wrappers around the underlying - <code class="Fn">arc4rand</code>() interface. - <code class="Fn">arc4random</code>() returns a 32-bit random value, while - <code class="Fn">arc4random_buf</code>() fills <var class="Fa">ptr</var> - with <var class="Fa">len</var> bytes of random data.</p> -<p class="Pp" id="arc4rand">The - <a class="permalink" href="#arc4rand"><code class="Fn">arc4rand</code></a>() - CSPRNG is seeded from the <a class="Xr">random(4)</a> kernel abstract - entropy device. Automatic reseeding happens at unspecified time and bytes - (of output) intervals. A reseed can be forced by passing a non-zero - <var class="Fa">reseed</var> value.</p> -<p class="Pp" id="read_random">The - <a class="permalink" href="#read_random"><code class="Fn">read_random</code></a>() - function is used to read entropy directly from the kernel abstract entropy - device. <code class="Fn">read_random</code>() blocks if and until the - entropy device is seeded. The provided <var class="Fa">buffer</var> is - filled with no more than <var class="Fa">count</var> bytes. It is strongly - advised that <code class="Fn">read_random</code>() is not used directly; - instead, use the <code class="Fn">arc4rand</code>() family of functions.</p> -<p class="Pp" id="is_random_seeded">The - <a class="permalink" href="#is_random_seeded"><code class="Fn">is_random_seeded</code></a>() - function can be used to check in advance if - <code class="Fn">read_random</code>() will block. (If random is seeded, it - will not block.)</p> -<p class="Pp" id="read_random_uio">The - <a class="permalink" href="#read_random_uio"><code class="Fn">read_random_uio</code></a>() - function behaves identically to <a class="Xr">read(2)</a> on - <span class="Pa">/dev/random</span>. The <var class="Fa">uio</var> argument - points to a buffer where random data should be stored. If - <var class="Fa">nonblock</var> is true and the random device is not seeded, - this function does not return any data. Otherwise, this function may block - interruptibly until the random device is seeded. If the function is - interrupted before the random device is seeded, no data is returned.</p> -<p class="Pp" id="random">The deprecated - <a class="permalink" href="#random"><code class="Fn">random</code></a>() - function will return a 31-bit value. It is obsolete and scheduled to be - removed in <span class="Ux">FreeBSD 16.0</span>. Consider - <a class="Xr">prng(9)</a> instead and see - <a class="Sx" href="#SECURITY_CONSIDERATIONS">SECURITY - CONSIDERATIONS</a>.</p> -</section> -<section class="Sh"> -<h1 class="Sh" id="RETURN_VALUES"><a class="permalink" href="#RETURN_VALUES">RETURN - VALUES</a></h1> -<p class="Pp">The <code class="Fn">arc4rand</code>() function uses the Chacha20 - algorithm to generate a pseudo-random sequence of bytes. The - <code class="Fn">arc4random</code>() function uses - <code class="Fn">arc4rand</code>() to generate pseudo-random numbers in the - range from 0 to (2**32)−1.</p> -<p class="Pp">The <code class="Fn">read_random</code>() function returns the - number of bytes placed in <var class="Fa">buffer</var>.</p> -<p class="Pp"><code class="Fn">read_random_uio</code>() returns zero when - successful, otherwise an error code is returned.</p> -<p class="Pp"><code class="Fn">random</code>() returns numbers in the range from - 0 to (2**31)−1.</p> -<p class="Pp"></p> -</section> -<section class="Sh"> -<h1 class="Sh" id="ERRORS"><a class="permalink" href="#ERRORS">ERRORS</a></h1> -<p class="Pp"><code class="Fn">read_random_uio</code>() may fail if:</p> -<dl class="Bl-tag"> - <dt id="EFAULT">[<a class="permalink" href="#EFAULT"><code class="Er">EFAULT</code></a>]</dt> - <dd><var class="Fa">uio</var> points to an invalid memory region.</dd> - <dt id="EWOULDBLOCK">[<a class="permalink" href="#EWOULDBLOCK"><code class="Er">EWOULDBLOCK</code></a>]</dt> - <dd>The random device is unseeded and <var class="Fa">nonblock</var> is - true.</dd> -</dl> -</section> -<section class="Sh"> -<h1 class="Sh" id="AUTHORS"><a class="permalink" href="#AUTHORS">AUTHORS</a></h1> -<p class="Pp"><span class="An">Dan Moschuk</span> wrote - <code class="Fn">arc4random</code>(). - <br/> - <span class="An">Mark R V Murray</span> wrote - <code class="Fn">read_random</code>().</p> -</section> -<section class="Sh"> -<h1 class="Sh" id="SECURITY_CONSIDERATIONS"><a class="permalink" href="#SECURITY_CONSIDERATIONS">SECURITY - CONSIDERATIONS</a></h1> -<p class="Pp">Do not use <code class="Fn">random</code>() in new code.</p> -<p class="Pp">It is important to remember that the - <code class="Fn">random</code>() function is entirely predictable. It is - easy for attackers to predict future output of - <code class="Fn">random</code>() by recording some generated values. We - cannot emphasize strongly enough that <code class="Fn">random</code>() must - not be used to generate values that are intended to be unpredictable.</p> -</section> -</div> -<table class="foot"> - <tr> - <td class="foot-date">May 11, 2025</td> - <td class="foot-os">FreeBSD 15.0</td> - </tr> -</table> |
