xref: /freebsd/crypto/heimdal/doc/doxyout/hcrypto/html/group__hcrypto__rand.html (revision 3f0164abf32b9b761e0a2cb4bdca3a8b84f156d4)
1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2<html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
3<title>Heimdal crypto library: RAND crypto functions</title>
4<link href="doxygen.css" rel="stylesheet" type="text/css">
5<link href="tabs.css" rel="stylesheet" type="text/css">
6</head><body>
7<p>
8<a href="http://www.h5l.org/"><img src="http://www.h5l.org/keyhole-heimdal.png" alt="keyhole logo"/></a>
9</p>
10<!-- end of header marker -->
11<!-- Generated by Doxygen 1.5.6 -->
12<div class="navigation" id="top">
13  <div class="tabs">
14    <ul>
15      <li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
16      <li><a href="modules.html"><span>Modules</span></a></li>
17      <li><a href="examples.html"><span>Examples</span></a></li>
18    </ul>
19  </div>
20</div>
21<div class="contents">
22<h1>RAND crypto functions</h1><table border="0" cellpadding="0" cellspacing="0">
23<tr><td></td></tr>
24<tr><td colspan="2"><br><h2>Functions</h2></td></tr>
25<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__hcrypto__rand.html#g700cd34f79c820f427f95c243befe085">RAND_seed</a> (const void *indata, size_t size)</td></tr>
26
27<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__hcrypto__rand.html#g957a044ad71e3c915ff7acc564be84a4">RAND_bytes</a> (void *outdata, size_t size)</td></tr>
28
29<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__hcrypto__rand.html#gd797e371751dedbcce4e975c3cad1947">RAND_cleanup</a> (void)</td></tr>
30
31<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__hcrypto__rand.html#g08927181178dc6329264982f2fb1b39b">RAND_add</a> (const void *indata, size_t size, double entropi)</td></tr>
32
33<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__hcrypto__rand.html#g93d10a9ba8647408a3b5306c2cd423f2">RAND_pseudo_bytes</a> (void *outdata, size_t size)</td></tr>
34
35<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__hcrypto__rand.html#g38d21605e6e777451769a8ee7087933b">RAND_status</a> (void)</td></tr>
36
37<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__hcrypto__rand.html#g292ae50ca725d0c529dc077467b40254">RAND_set_rand_method</a> (const RAND_METHOD *meth)</td></tr>
38
39<tr><td class="memItemLeft" nowrap align="right" valign="top">const RAND_METHOD *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__hcrypto__rand.html#g8a8cac7a3262c4527e08f57f07c4c586">RAND_get_rand_method</a> (void)</td></tr>
40
41<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__hcrypto__rand.html#g6a4f2c2cf723ef63522d4b33c79d5f0f">RAND_set_rand_engine</a> (ENGINE *engine)</td></tr>
42
43<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__hcrypto__rand.html#g9ca9fe0e799e41e8e745a88e3a60ccfd">RAND_load_file</a> (const char *filename, size_t size)</td></tr>
44
45<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__hcrypto__rand.html#gb9638d698e0a8ab94a31322693588eba">RAND_write_file</a> (const char *filename)</td></tr>
46
47<tr><td class="memItemLeft" nowrap align="right" valign="top">const char *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__hcrypto__rand.html#g77b2d2555388b5d75a4bab3843fc8f02">RAND_file_name</a> (char *filename, size_t size)</td></tr>
48
49</table>
50<hr><a name="_details"></a><h2>Detailed Description</h2>
51See the <a class="el" href="page_rand.html">RAND - random number</a> for description and examples. <hr><h2>Function Documentation</h2>
52<a class="anchor" name="g08927181178dc6329264982f2fb1b39b"></a><!-- doxytag: member="rand.c::RAND_add" ref="g08927181178dc6329264982f2fb1b39b" args="(const void *indata, size_t size, double entropi)" -->
53<div class="memitem">
54<div class="memproto">
55      <table class="memname">
56        <tr>
57          <td class="memname">void RAND_add           </td>
58          <td>(</td>
59          <td class="paramtype">const void *&nbsp;</td>
60          <td class="paramname"> <em>indata</em>, </td>
61        </tr>
62        <tr>
63          <td class="paramkey"></td>
64          <td></td>
65          <td class="paramtype">size_t&nbsp;</td>
66          <td class="paramname"> <em>size</em>, </td>
67        </tr>
68        <tr>
69          <td class="paramkey"></td>
70          <td></td>
71          <td class="paramtype">double&nbsp;</td>
72          <td class="paramname"> <em>entropi</em></td><td>&nbsp;</td>
73        </tr>
74        <tr>
75          <td></td>
76          <td>)</td>
77          <td></td><td></td><td></td>
78        </tr>
79      </table>
80</div>
81<div class="memdoc">
82
83<p>
84Seed that random number generator. Secret material can securely be feed into the function, they will never be returned.<p>
85<dl compact><dt><b>Parameters:</b></dt><dd>
86  <table border="0" cellspacing="2" cellpadding="0">
87    <tr><td valign="top"></td><td valign="top"><em>indata</em>&nbsp;</td><td>the input data. </td></tr>
88    <tr><td valign="top"></td><td valign="top"><em>size</em>&nbsp;</td><td>size of in data. </td></tr>
89    <tr><td valign="top"></td><td valign="top"><em>entropi</em>&nbsp;</td><td>entropi in data. </td></tr>
90  </table>
91</dl>
92
93</div>
94</div><p>
95<a class="anchor" name="g957a044ad71e3c915ff7acc564be84a4"></a><!-- doxytag: member="rand.c::RAND_bytes" ref="g957a044ad71e3c915ff7acc564be84a4" args="(void *outdata, size_t size)" -->
96<div class="memitem">
97<div class="memproto">
98      <table class="memname">
99        <tr>
100          <td class="memname">int RAND_bytes           </td>
101          <td>(</td>
102          <td class="paramtype">void *&nbsp;</td>
103          <td class="paramname"> <em>outdata</em>, </td>
104        </tr>
105        <tr>
106          <td class="paramkey"></td>
107          <td></td>
108          <td class="paramtype">size_t&nbsp;</td>
109          <td class="paramname"> <em>size</em></td><td>&nbsp;</td>
110        </tr>
111        <tr>
112          <td></td>
113          <td>)</td>
114          <td></td><td></td><td></td>
115        </tr>
116      </table>
117</div>
118<div class="memdoc">
119
120<p>
121Get a random block from the random generator, can be used for key material.<p>
122<dl compact><dt><b>Parameters:</b></dt><dd>
123  <table border="0" cellspacing="2" cellpadding="0">
124    <tr><td valign="top"></td><td valign="top"><em>outdata</em>&nbsp;</td><td>random data </td></tr>
125    <tr><td valign="top"></td><td valign="top"><em>size</em>&nbsp;</td><td>length random data</td></tr>
126  </table>
127</dl>
128<dl class="return" compact><dt><b>Returns:</b></dt><dd>1 on success, 0 on failure. </dd></dl>
129
130</div>
131</div><p>
132<a class="anchor" name="gd797e371751dedbcce4e975c3cad1947"></a><!-- doxytag: member="rand.c::RAND_cleanup" ref="gd797e371751dedbcce4e975c3cad1947" args="(void)" -->
133<div class="memitem">
134<div class="memproto">
135      <table class="memname">
136        <tr>
137          <td class="memname">void RAND_cleanup           </td>
138          <td>(</td>
139          <td class="paramtype">void&nbsp;</td>
140          <td class="paramname">          </td>
141          <td>&nbsp;)&nbsp;</td>
142          <td></td>
143        </tr>
144      </table>
145</div>
146<div class="memdoc">
147
148<p>
149Reset and free memory used by the random generator.
150</div>
151</div><p>
152<a class="anchor" name="g77b2d2555388b5d75a4bab3843fc8f02"></a><!-- doxytag: member="rand.c::RAND_file_name" ref="g77b2d2555388b5d75a4bab3843fc8f02" args="(char *filename, size_t size)" -->
153<div class="memitem">
154<div class="memproto">
155      <table class="memname">
156        <tr>
157          <td class="memname">const char* RAND_file_name           </td>
158          <td>(</td>
159          <td class="paramtype">char *&nbsp;</td>
160          <td class="paramname"> <em>filename</em>, </td>
161        </tr>
162        <tr>
163          <td class="paramkey"></td>
164          <td></td>
165          <td class="paramtype">size_t&nbsp;</td>
166          <td class="paramname"> <em>size</em></td><td>&nbsp;</td>
167        </tr>
168        <tr>
169          <td></td>
170          <td>)</td>
171          <td></td><td></td><td></td>
172        </tr>
173      </table>
174</div>
175<div class="memdoc">
176
177<p>
178Return the default random state filename for a user to use for <a class="el" href="group__hcrypto__rand.html#g9ca9fe0e799e41e8e745a88e3a60ccfd">RAND_load_file()</a>, and <a class="el" href="group__hcrypto__rand.html#gb9638d698e0a8ab94a31322693588eba">RAND_write_file()</a>.<p>
179<dl compact><dt><b>Parameters:</b></dt><dd>
180  <table border="0" cellspacing="2" cellpadding="0">
181    <tr><td valign="top"></td><td valign="top"><em>filename</em>&nbsp;</td><td>buffer to hold file name. </td></tr>
182    <tr><td valign="top"></td><td valign="top"><em>size</em>&nbsp;</td><td>size of buffer filename.</td></tr>
183  </table>
184</dl>
185<dl class="return" compact><dt><b>Returns:</b></dt><dd>the buffer filename or NULL on failure. </dd></dl>
186
187</div>
188</div><p>
189<a class="anchor" name="g8a8cac7a3262c4527e08f57f07c4c586"></a><!-- doxytag: member="rand.c::RAND_get_rand_method" ref="g8a8cac7a3262c4527e08f57f07c4c586" args="(void)" -->
190<div class="memitem">
191<div class="memproto">
192      <table class="memname">
193        <tr>
194          <td class="memname">const RAND_METHOD* RAND_get_rand_method           </td>
195          <td>(</td>
196          <td class="paramtype">void&nbsp;</td>
197          <td class="paramname">          </td>
198          <td>&nbsp;)&nbsp;</td>
199          <td></td>
200        </tr>
201      </table>
202</div>
203<div class="memdoc">
204
205<p>
206Get the default random method.
207</div>
208</div><p>
209<a class="anchor" name="g9ca9fe0e799e41e8e745a88e3a60ccfd"></a><!-- doxytag: member="rand.c::RAND_load_file" ref="g9ca9fe0e799e41e8e745a88e3a60ccfd" args="(const char *filename, size_t size)" -->
210<div class="memitem">
211<div class="memproto">
212      <table class="memname">
213        <tr>
214          <td class="memname">int RAND_load_file           </td>
215          <td>(</td>
216          <td class="paramtype">const char *&nbsp;</td>
217          <td class="paramname"> <em>filename</em>, </td>
218        </tr>
219        <tr>
220          <td class="paramkey"></td>
221          <td></td>
222          <td class="paramtype">size_t&nbsp;</td>
223          <td class="paramname"> <em>size</em></td><td>&nbsp;</td>
224        </tr>
225        <tr>
226          <td></td>
227          <td>)</td>
228          <td></td><td></td><td></td>
229        </tr>
230      </table>
231</div>
232<div class="memdoc">
233
234<p>
235Load a a file and feed it into <a class="el" href="group__hcrypto__rand.html#g700cd34f79c820f427f95c243befe085">RAND_seed()</a>.<p>
236<dl compact><dt><b>Parameters:</b></dt><dd>
237  <table border="0" cellspacing="2" cellpadding="0">
238    <tr><td valign="top"></td><td valign="top"><em>filename</em>&nbsp;</td><td>name of file to read. </td></tr>
239    <tr><td valign="top"></td><td valign="top"><em>size</em>&nbsp;</td><td>minimum size to read. </td></tr>
240  </table>
241</dl>
242
243</div>
244</div><p>
245<a class="anchor" name="g93d10a9ba8647408a3b5306c2cd423f2"></a><!-- doxytag: member="rand.c::RAND_pseudo_bytes" ref="g93d10a9ba8647408a3b5306c2cd423f2" args="(void *outdata, size_t size)" -->
246<div class="memitem">
247<div class="memproto">
248      <table class="memname">
249        <tr>
250          <td class="memname">int RAND_pseudo_bytes           </td>
251          <td>(</td>
252          <td class="paramtype">void *&nbsp;</td>
253          <td class="paramname"> <em>outdata</em>, </td>
254        </tr>
255        <tr>
256          <td class="paramkey"></td>
257          <td></td>
258          <td class="paramtype">size_t&nbsp;</td>
259          <td class="paramname"> <em>size</em></td><td>&nbsp;</td>
260        </tr>
261        <tr>
262          <td></td>
263          <td>)</td>
264          <td></td><td></td><td></td>
265        </tr>
266      </table>
267</div>
268<div class="memdoc">
269
270<p>
271Get a random block from the random generator, should NOT be used for key material.<p>
272<dl compact><dt><b>Parameters:</b></dt><dd>
273  <table border="0" cellspacing="2" cellpadding="0">
274    <tr><td valign="top"></td><td valign="top"><em>outdata</em>&nbsp;</td><td>random data </td></tr>
275    <tr><td valign="top"></td><td valign="top"><em>size</em>&nbsp;</td><td>length random data</td></tr>
276  </table>
277</dl>
278<dl class="return" compact><dt><b>Returns:</b></dt><dd>1 on success, 0 on failure. </dd></dl>
279
280</div>
281</div><p>
282<a class="anchor" name="g700cd34f79c820f427f95c243befe085"></a><!-- doxytag: member="rand.c::RAND_seed" ref="g700cd34f79c820f427f95c243befe085" args="(const void *indata, size_t size)" -->
283<div class="memitem">
284<div class="memproto">
285      <table class="memname">
286        <tr>
287          <td class="memname">void RAND_seed           </td>
288          <td>(</td>
289          <td class="paramtype">const void *&nbsp;</td>
290          <td class="paramname"> <em>indata</em>, </td>
291        </tr>
292        <tr>
293          <td class="paramkey"></td>
294          <td></td>
295          <td class="paramtype">size_t&nbsp;</td>
296          <td class="paramname"> <em>size</em></td><td>&nbsp;</td>
297        </tr>
298        <tr>
299          <td></td>
300          <td>)</td>
301          <td></td><td></td><td></td>
302        </tr>
303      </table>
304</div>
305<div class="memdoc">
306
307<p>
308Seed that random number generator. Secret material can securely be feed into the function, they will never be returned.<p>
309<dl compact><dt><b>Parameters:</b></dt><dd>
310  <table border="0" cellspacing="2" cellpadding="0">
311    <tr><td valign="top"></td><td valign="top"><em>indata</em>&nbsp;</td><td>seed data </td></tr>
312    <tr><td valign="top"></td><td valign="top"><em>size</em>&nbsp;</td><td>length seed data </td></tr>
313  </table>
314</dl>
315
316</div>
317</div><p>
318<a class="anchor" name="g6a4f2c2cf723ef63522d4b33c79d5f0f"></a><!-- doxytag: member="rand.c::RAND_set_rand_engine" ref="g6a4f2c2cf723ef63522d4b33c79d5f0f" args="(ENGINE *engine)" -->
319<div class="memitem">
320<div class="memproto">
321      <table class="memname">
322        <tr>
323          <td class="memname">int RAND_set_rand_engine           </td>
324          <td>(</td>
325          <td class="paramtype">ENGINE *&nbsp;</td>
326          <td class="paramname"> <em>engine</em>          </td>
327          <td>&nbsp;)&nbsp;</td>
328          <td></td>
329        </tr>
330      </table>
331</div>
332<div class="memdoc">
333
334<p>
335Set the default random method from engine.<p>
336<dl compact><dt><b>Parameters:</b></dt><dd>
337  <table border="0" cellspacing="2" cellpadding="0">
338    <tr><td valign="top"></td><td valign="top"><em>engine</em>&nbsp;</td><td>use engine, if NULL is passed it, old method and engine is cleared.</td></tr>
339  </table>
340</dl>
341<dl class="return" compact><dt><b>Returns:</b></dt><dd>1 on success, 0 on failure. </dd></dl>
342
343</div>
344</div><p>
345<a class="anchor" name="g292ae50ca725d0c529dc077467b40254"></a><!-- doxytag: member="rand.c::RAND_set_rand_method" ref="g292ae50ca725d0c529dc077467b40254" args="(const RAND_METHOD *meth)" -->
346<div class="memitem">
347<div class="memproto">
348      <table class="memname">
349        <tr>
350          <td class="memname">int RAND_set_rand_method           </td>
351          <td>(</td>
352          <td class="paramtype">const RAND_METHOD *&nbsp;</td>
353          <td class="paramname"> <em>meth</em>          </td>
354          <td>&nbsp;)&nbsp;</td>
355          <td></td>
356        </tr>
357      </table>
358</div>
359<div class="memdoc">
360
361<p>
362Set the default random method.<p>
363<dl compact><dt><b>Parameters:</b></dt><dd>
364  <table border="0" cellspacing="2" cellpadding="0">
365    <tr><td valign="top"></td><td valign="top"><em>meth</em>&nbsp;</td><td>set the new default method.</td></tr>
366  </table>
367</dl>
368<dl class="return" compact><dt><b>Returns:</b></dt><dd>1 on success. </dd></dl>
369
370</div>
371</div><p>
372<a class="anchor" name="g38d21605e6e777451769a8ee7087933b"></a><!-- doxytag: member="rand.c::RAND_status" ref="g38d21605e6e777451769a8ee7087933b" args="(void)" -->
373<div class="memitem">
374<div class="memproto">
375      <table class="memname">
376        <tr>
377          <td class="memname">int RAND_status           </td>
378          <td>(</td>
379          <td class="paramtype">void&nbsp;</td>
380          <td class="paramname">          </td>
381          <td>&nbsp;)&nbsp;</td>
382          <td></td>
383        </tr>
384      </table>
385</div>
386<div class="memdoc">
387
388<p>
389Return status of the random generator<p>
390<dl class="return" compact><dt><b>Returns:</b></dt><dd>1 if the random generator can deliver random data. </dd></dl>
391
392</div>
393</div><p>
394<a class="anchor" name="gb9638d698e0a8ab94a31322693588eba"></a><!-- doxytag: member="rand.c::RAND_write_file" ref="gb9638d698e0a8ab94a31322693588eba" args="(const char *filename)" -->
395<div class="memitem">
396<div class="memproto">
397      <table class="memname">
398        <tr>
399          <td class="memname">int RAND_write_file           </td>
400          <td>(</td>
401          <td class="paramtype">const char *&nbsp;</td>
402          <td class="paramname"> <em>filename</em>          </td>
403          <td>&nbsp;)&nbsp;</td>
404          <td></td>
405        </tr>
406      </table>
407</div>
408<div class="memdoc">
409
410<p>
411Write of random numbers to a file to store for later initiation with <a class="el" href="group__hcrypto__rand.html#g9ca9fe0e799e41e8e745a88e3a60ccfd">RAND_load_file()</a>.<p>
412<dl compact><dt><b>Parameters:</b></dt><dd>
413  <table border="0" cellspacing="2" cellpadding="0">
414    <tr><td valign="top"></td><td valign="top"><em>filename</em>&nbsp;</td><td>name of file to write.</td></tr>
415  </table>
416</dl>
417<dl class="return" compact><dt><b>Returns:</b></dt><dd>1 on success and non-one on failure. </dd></dl>
418
419</div>
420</div><p>
421</div>
422<hr size="1"><address style="text-align: right;"><small>
423Generated on Wed Jan 11 14:07:38 2012 for Heimdal crypto library by&nbsp;<a href="http://www.doxygen.org/index.html"><img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.6</small></address>
424</body>
425</html>
426