1<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>struct rng_alg</title><meta name="generator" content="DocBook XSL Stylesheets V1.78.1"><link rel="home" href="index.html" title="Linux Kernel Crypto API"><link rel="up" href="ch05s02.html" title="Block Cipher Algorithm Definitions"><link rel="prev" href="API-struct-cipher-alg.html" title="struct cipher_alg"><link rel="next" href="ch05s03.html" title="Asynchronous Block Cipher API"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center"><span class="phrase">struct rng_alg</span></th></tr><tr><td width="20%" align="left"><a accesskey="p" href="API-struct-cipher-alg.html">Prev</a> </td><th width="60%" align="center">Block Cipher Algorithm Definitions</th><td width="20%" align="right"> <a accesskey="n" href="ch05s03.html">Next</a></td></tr></table><hr></div><div class="refentry"><a name="API-struct-rng-alg"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>struct rng_alg — 2 random number generator definition 3 </p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><pre class="programlisting"> 4struct rng_alg { 5 int (* generate) (struct crypto_rng *tfm,const u8 *src, unsigned int slen,u8 *dst, unsigned int dlen); 6 int (* seed) (struct crypto_rng *tfm, const u8 *seed, unsigned int slen); 7 void (* set_ent) (struct crypto_rng *tfm, const u8 *data,unsigned int len); 8 unsigned int seedsize; 9 struct crypto_alg base; 10}; </pre></div><div class="refsect1"><a name="id-1.7.4.9.5"></a><h2>Members</h2><div class="variablelist"><dl class="variablelist"><dt><span class="term">generate</span></dt><dd><p> 11The function defined by this variable obtains a 12random number. The random number generator transform 13must generate the random number out of the context 14provided with this call, plus any additional data 15if provided to the call. 16 </p></dd><dt><span class="term">seed</span></dt><dd><p> 17Seed or reseed the random number generator. With the 18invocation of this function call, the random number 19generator shall become ready for generation. If the 20random number generator requires a seed for setting 21up a new state, the seed must be provided by the 22consumer while invoking this function. The required 23size of the seed is defined with <em class="parameter"><code>seedsize</code></em> . 24 </p></dd><dt><span class="term">set_ent</span></dt><dd><p> 25Set entropy that would otherwise be obtained from 26entropy source. Internal use only. 27 </p></dd><dt><span class="term">seedsize</span></dt><dd><p> 28The seed size required for a random number generator 29initialization defined with this variable. Some 30random number generators does not require a seed 31as the seeding is implemented internally without 32the need of support by the consumer. In this case, 33the seed size is set to zero. 34 </p></dd><dt><span class="term">base</span></dt><dd><p> 35Common crypto API algorithm data structure. 36 </p></dd></dl></div></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="API-struct-cipher-alg.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="ch05s02.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="ch05s03.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top"><span class="phrase">struct cipher_alg</span> </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Asynchronous Block Cipher API</td></tr></table></div></body></html> 37