xref: /freebsd/crypto/heimdal/doc/doxyout/hcrypto/html/group__hcrypto__des.html (revision 39ee7a7a6bdd1557b1c3532abf60d139798ac88b)
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: DES 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>DES 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__des.html#g4179bef43ceb72cc2034f39e7d2d5ae4">DES_set_odd_parity</a> (DES_cblock *key)</td></tr>
26
27<tr><td class="memItemLeft" nowrap align="right" valign="top">int HC_DEPRECATED&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__hcrypto__des.html#gcf0d611296ad70edf90a3130b2f62c71">DES_check_key_parity</a> (DES_cblock *key)</td></tr>
28
29<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__hcrypto__des.html#g0d8a49cafee4be6cd3922bfb6323fd2d">DES_is_weak_key</a> (DES_cblock *key)</td></tr>
30
31<tr><td class="memItemLeft" nowrap align="right" valign="top">int HC_DEPRECATED&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__hcrypto__des.html#gad10e059974f3048b3de49599989486b">DES_set_key</a> (DES_cblock *key, DES_key_schedule *ks)</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__des.html#g8131d59b5c0f65ca8bba0873932680d5">DES_set_key_unchecked</a> (DES_cblock *key, DES_key_schedule *ks)</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__des.html#g3157dd2419a25cd4381867f012117d07">DES_set_key_checked</a> (DES_cblock *key, DES_key_schedule *ks)</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__des.html#gf5b4967f13a4a52c214c28b6e57a3a95">DES_key_sched</a> (DES_cblock *key, DES_key_schedule *ks)</td></tr>
38
39<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__hcrypto__des.html#g39662a8c2218601d402a895f08813662">DES_encrypt</a> (uint32_t u[2], DES_key_schedule *ks, int encp)</td></tr>
40
41<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__hcrypto__des.html#ga5cf9203994e3a5ece2ef7a85e7a2875">DES_ecb_encrypt</a> (DES_cblock *input, DES_cblock *output, DES_key_schedule *ks, int encp)</td></tr>
42
43<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__hcrypto__des.html#g4946e6d9a944f8f029df4e6c68d1868e">DES_cbc_encrypt</a> (const void *in, void *out, long length, DES_key_schedule *ks, DES_cblock *iv, int encp)</td></tr>
44
45<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__hcrypto__des.html#g336e497f66748e92b93fc0b4512d78c2">DES_pcbc_encrypt</a> (const void *in, void *out, long length, DES_key_schedule *ks, DES_cblock *iv, int encp)</td></tr>
46
47<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__hcrypto__des.html#gf2de06942efdf1bd45ce0a8c0597654e">DES_ecb3_encrypt</a> (DES_cblock *input, DES_cblock *output, DES_key_schedule *ks1, DES_key_schedule *ks2, DES_key_schedule *ks3, int encp)</td></tr>
48
49<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__hcrypto__des.html#g36a83e8a4de4ac0f93ea932229dc3607">DES_ede3_cbc_encrypt</a> (const void *in, void *out, long length, DES_key_schedule *ks1, DES_key_schedule *ks2, DES_key_schedule *ks3, DES_cblock *iv, int encp)</td></tr>
50
51<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__hcrypto__des.html#g9c2b24baea3d4e69524335a79e22ae2d">DES_cfb64_encrypt</a> (const void *in, void *out, long length, DES_key_schedule *ks, DES_cblock *iv, int *num, int encp)</td></tr>
52
53<tr><td class="memItemLeft" nowrap align="right" valign="top">uint32_t&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__hcrypto__des.html#gbf8f1cc95fd03ec1ef59563f9659ec42">DES_cbc_cksum</a> (const void *in, DES_cblock *output, long length, DES_key_schedule *ks, DES_cblock *iv)</td></tr>
54
55<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__hcrypto__des.html#g60893cdc75d9ce8cbf4a5d7a874855c8">DES_string_to_key</a> (const char *str, DES_cblock *key)</td></tr>
56
57<tr><td class="memItemLeft" nowrap align="right" valign="top">int HC_DEPRECATED&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__hcrypto__des.html#gcd3642bcd8a7e93ea977786e5b540d5f">DES_new_random_key</a> (DES_cblock *key)</td></tr>
58
59<tr><td class="memItemLeft" nowrap align="right" valign="top">void HC_DEPRECATED&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__hcrypto__des.html#g45739e74db49d07bfaa0d7918efd4875">DES_init_random_number_generator</a> (DES_cblock *seed)</td></tr>
60
61<tr><td class="memItemLeft" nowrap align="right" valign="top">void HC_DEPRECATED&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__hcrypto__des.html#gd70d485549f7444589f3283e938c0258">DES_random_key</a> (DES_cblock *key)</td></tr>
62
63</table>
64<hr><a name="_details"></a><h2>Detailed Description</h2>
65See the <a class="el" href="page_des.html">DES - Data Encryption Standard crypto interface</a> for description and examples. <hr><h2>Function Documentation</h2>
66<a class="anchor" name="gbf8f1cc95fd03ec1ef59563f9659ec42"></a><!-- doxytag: member="des.c::DES_cbc_cksum" ref="gbf8f1cc95fd03ec1ef59563f9659ec42" args="(const void *in, DES_cblock *output, long length, DES_key_schedule *ks, DES_cblock *iv)" -->
67<div class="memitem">
68<div class="memproto">
69      <table class="memname">
70        <tr>
71          <td class="memname">uint32_t DES_cbc_cksum           </td>
72          <td>(</td>
73          <td class="paramtype">const void *&nbsp;</td>
74          <td class="paramname"> <em>in</em>, </td>
75        </tr>
76        <tr>
77          <td class="paramkey"></td>
78          <td></td>
79          <td class="paramtype">DES_cblock *&nbsp;</td>
80          <td class="paramname"> <em>output</em>, </td>
81        </tr>
82        <tr>
83          <td class="paramkey"></td>
84          <td></td>
85          <td class="paramtype">long&nbsp;</td>
86          <td class="paramname"> <em>length</em>, </td>
87        </tr>
88        <tr>
89          <td class="paramkey"></td>
90          <td></td>
91          <td class="paramtype">DES_key_schedule *&nbsp;</td>
92          <td class="paramname"> <em>ks</em>, </td>
93        </tr>
94        <tr>
95          <td class="paramkey"></td>
96          <td></td>
97          <td class="paramtype">DES_cblock *&nbsp;</td>
98          <td class="paramname"> <em>iv</em></td><td>&nbsp;</td>
99        </tr>
100        <tr>
101          <td></td>
102          <td>)</td>
103          <td></td><td></td><td></td>
104        </tr>
105      </table>
106</div>
107<div class="memdoc">
108
109<p>
110Crete a checksum using DES in CBC encryption mode. This mode is only used for Kerberos 4, and it should stay that way.<p>
111The IV must always be diffrent for diffrent input data blocks.<p>
112<dl compact><dt><b>Parameters:</b></dt><dd>
113  <table border="0" cellspacing="2" cellpadding="0">
114    <tr><td valign="top"></td><td valign="top"><em>in</em>&nbsp;</td><td>data to checksum </td></tr>
115    <tr><td valign="top"></td><td valign="top"><em>output</em>&nbsp;</td><td>the checksum </td></tr>
116    <tr><td valign="top"></td><td valign="top"><em>length</em>&nbsp;</td><td>length of data </td></tr>
117    <tr><td valign="top"></td><td valign="top"><em>ks</em>&nbsp;</td><td>key schedule to use </td></tr>
118    <tr><td valign="top"></td><td valign="top"><em>iv</em>&nbsp;</td><td>initial vector to use </td></tr>
119  </table>
120</dl>
121
122</div>
123</div><p>
124<a class="anchor" name="g4946e6d9a944f8f029df4e6c68d1868e"></a><!-- doxytag: member="des.c::DES_cbc_encrypt" ref="g4946e6d9a944f8f029df4e6c68d1868e" args="(const void *in, void *out, long length, DES_key_schedule *ks, DES_cblock *iv, int encp)" -->
125<div class="memitem">
126<div class="memproto">
127      <table class="memname">
128        <tr>
129          <td class="memname">void DES_cbc_encrypt           </td>
130          <td>(</td>
131          <td class="paramtype">const void *&nbsp;</td>
132          <td class="paramname"> <em>in</em>, </td>
133        </tr>
134        <tr>
135          <td class="paramkey"></td>
136          <td></td>
137          <td class="paramtype">void *&nbsp;</td>
138          <td class="paramname"> <em>out</em>, </td>
139        </tr>
140        <tr>
141          <td class="paramkey"></td>
142          <td></td>
143          <td class="paramtype">long&nbsp;</td>
144          <td class="paramname"> <em>length</em>, </td>
145        </tr>
146        <tr>
147          <td class="paramkey"></td>
148          <td></td>
149          <td class="paramtype">DES_key_schedule *&nbsp;</td>
150          <td class="paramname"> <em>ks</em>, </td>
151        </tr>
152        <tr>
153          <td class="paramkey"></td>
154          <td></td>
155          <td class="paramtype">DES_cblock *&nbsp;</td>
156          <td class="paramname"> <em>iv</em>, </td>
157        </tr>
158        <tr>
159          <td class="paramkey"></td>
160          <td></td>
161          <td class="paramtype">int&nbsp;</td>
162          <td class="paramname"> <em>encp</em></td><td>&nbsp;</td>
163        </tr>
164        <tr>
165          <td></td>
166          <td>)</td>
167          <td></td><td></td><td></td>
168        </tr>
169      </table>
170</div>
171<div class="memdoc">
172
173<p>
174Encrypt/decrypt a block using DES in Chain Block Cipher mode (cbc).<p>
175The IV must always be diffrent for diffrent input data blocks.<p>
176<dl compact><dt><b>Parameters:</b></dt><dd>
177  <table border="0" cellspacing="2" cellpadding="0">
178    <tr><td valign="top"></td><td valign="top"><em>in</em>&nbsp;</td><td>data to encrypt </td></tr>
179    <tr><td valign="top"></td><td valign="top"><em>out</em>&nbsp;</td><td>data to encrypt </td></tr>
180    <tr><td valign="top"></td><td valign="top"><em>length</em>&nbsp;</td><td>length of data </td></tr>
181    <tr><td valign="top"></td><td valign="top"><em>ks</em>&nbsp;</td><td>key schedule to use </td></tr>
182    <tr><td valign="top"></td><td valign="top"><em>iv</em>&nbsp;</td><td>initial vector to use </td></tr>
183    <tr><td valign="top"></td><td valign="top"><em>encp</em>&nbsp;</td><td>if non zero, encrypt. if zero, decrypt. </td></tr>
184  </table>
185</dl>
186
187</div>
188</div><p>
189<a class="anchor" name="g9c2b24baea3d4e69524335a79e22ae2d"></a><!-- doxytag: member="des.c::DES_cfb64_encrypt" ref="g9c2b24baea3d4e69524335a79e22ae2d" args="(const void *in, void *out, long length, DES_key_schedule *ks, DES_cblock *iv, int *num, int encp)" -->
190<div class="memitem">
191<div class="memproto">
192      <table class="memname">
193        <tr>
194          <td class="memname">void DES_cfb64_encrypt           </td>
195          <td>(</td>
196          <td class="paramtype">const void *&nbsp;</td>
197          <td class="paramname"> <em>in</em>, </td>
198        </tr>
199        <tr>
200          <td class="paramkey"></td>
201          <td></td>
202          <td class="paramtype">void *&nbsp;</td>
203          <td class="paramname"> <em>out</em>, </td>
204        </tr>
205        <tr>
206          <td class="paramkey"></td>
207          <td></td>
208          <td class="paramtype">long&nbsp;</td>
209          <td class="paramname"> <em>length</em>, </td>
210        </tr>
211        <tr>
212          <td class="paramkey"></td>
213          <td></td>
214          <td class="paramtype">DES_key_schedule *&nbsp;</td>
215          <td class="paramname"> <em>ks</em>, </td>
216        </tr>
217        <tr>
218          <td class="paramkey"></td>
219          <td></td>
220          <td class="paramtype">DES_cblock *&nbsp;</td>
221          <td class="paramname"> <em>iv</em>, </td>
222        </tr>
223        <tr>
224          <td class="paramkey"></td>
225          <td></td>
226          <td class="paramtype">int *&nbsp;</td>
227          <td class="paramname"> <em>num</em>, </td>
228        </tr>
229        <tr>
230          <td class="paramkey"></td>
231          <td></td>
232          <td class="paramtype">int&nbsp;</td>
233          <td class="paramname"> <em>encp</em></td><td>&nbsp;</td>
234        </tr>
235        <tr>
236          <td></td>
237          <td>)</td>
238          <td></td><td></td><td></td>
239        </tr>
240      </table>
241</div>
242<div class="memdoc">
243
244<p>
245Encrypt/decrypt using DES in cipher feedback mode with 64 bit feedback.<p>
246The IV must always be diffrent for diffrent input data blocks.<p>
247<dl compact><dt><b>Parameters:</b></dt><dd>
248  <table border="0" cellspacing="2" cellpadding="0">
249    <tr><td valign="top"></td><td valign="top"><em>in</em>&nbsp;</td><td>data to encrypt </td></tr>
250    <tr><td valign="top"></td><td valign="top"><em>out</em>&nbsp;</td><td>data to encrypt </td></tr>
251    <tr><td valign="top"></td><td valign="top"><em>length</em>&nbsp;</td><td>length of data </td></tr>
252    <tr><td valign="top"></td><td valign="top"><em>ks</em>&nbsp;</td><td>key schedule to use </td></tr>
253    <tr><td valign="top"></td><td valign="top"><em>iv</em>&nbsp;</td><td>initial vector to use </td></tr>
254    <tr><td valign="top"></td><td valign="top"><em>num</em>&nbsp;</td><td>offset into in cipher block encryption/decryption stop last time. </td></tr>
255    <tr><td valign="top"></td><td valign="top"><em>encp</em>&nbsp;</td><td>if non zero, encrypt. if zero, decrypt. </td></tr>
256  </table>
257</dl>
258
259</div>
260</div><p>
261<a class="anchor" name="gcf0d611296ad70edf90a3130b2f62c71"></a><!-- doxytag: member="des.c::DES_check_key_parity" ref="gcf0d611296ad70edf90a3130b2f62c71" args="(DES_cblock *key)" -->
262<div class="memitem">
263<div class="memproto">
264      <table class="memname">
265        <tr>
266          <td class="memname">int HC_DEPRECATED DES_check_key_parity           </td>
267          <td>(</td>
268          <td class="paramtype">DES_cblock *&nbsp;</td>
269          <td class="paramname"> <em>key</em>          </td>
270          <td>&nbsp;)&nbsp;</td>
271          <td></td>
272        </tr>
273      </table>
274</div>
275<div class="memdoc">
276
277<p>
278Check if the key have correct parity.<p>
279<dl compact><dt><b>Parameters:</b></dt><dd>
280  <table border="0" cellspacing="2" cellpadding="0">
281    <tr><td valign="top"></td><td valign="top"><em>key</em>&nbsp;</td><td>key to check the parity. </td></tr>
282  </table>
283</dl>
284<dl class="return" compact><dt><b>Returns:</b></dt><dd>1 on success, 0 on failure. </dd></dl>
285
286</div>
287</div><p>
288<a class="anchor" name="gf2de06942efdf1bd45ce0a8c0597654e"></a><!-- doxytag: member="des.c::DES_ecb3_encrypt" ref="gf2de06942efdf1bd45ce0a8c0597654e" args="(DES_cblock *input, DES_cblock *output, DES_key_schedule *ks1, DES_key_schedule *ks2, DES_key_schedule *ks3, int encp)" -->
289<div class="memitem">
290<div class="memproto">
291      <table class="memname">
292        <tr>
293          <td class="memname">void DES_ecb3_encrypt           </td>
294          <td>(</td>
295          <td class="paramtype">DES_cblock *&nbsp;</td>
296          <td class="paramname"> <em>input</em>, </td>
297        </tr>
298        <tr>
299          <td class="paramkey"></td>
300          <td></td>
301          <td class="paramtype">DES_cblock *&nbsp;</td>
302          <td class="paramname"> <em>output</em>, </td>
303        </tr>
304        <tr>
305          <td class="paramkey"></td>
306          <td></td>
307          <td class="paramtype">DES_key_schedule *&nbsp;</td>
308          <td class="paramname"> <em>ks1</em>, </td>
309        </tr>
310        <tr>
311          <td class="paramkey"></td>
312          <td></td>
313          <td class="paramtype">DES_key_schedule *&nbsp;</td>
314          <td class="paramname"> <em>ks2</em>, </td>
315        </tr>
316        <tr>
317          <td class="paramkey"></td>
318          <td></td>
319          <td class="paramtype">DES_key_schedule *&nbsp;</td>
320          <td class="paramname"> <em>ks3</em>, </td>
321        </tr>
322        <tr>
323          <td class="paramkey"></td>
324          <td></td>
325          <td class="paramtype">int&nbsp;</td>
326          <td class="paramname"> <em>encp</em></td><td>&nbsp;</td>
327        </tr>
328        <tr>
329          <td></td>
330          <td>)</td>
331          <td></td><td></td><td></td>
332        </tr>
333      </table>
334</div>
335<div class="memdoc">
336
337<p>
338Encrypt/decrypt a block using triple DES using EDE mode, encrypt/decrypt/encrypt.<p>
339<dl compact><dt><b>Parameters:</b></dt><dd>
340  <table border="0" cellspacing="2" cellpadding="0">
341    <tr><td valign="top"></td><td valign="top"><em>input</em>&nbsp;</td><td>data to encrypt </td></tr>
342    <tr><td valign="top"></td><td valign="top"><em>output</em>&nbsp;</td><td>data to encrypt </td></tr>
343    <tr><td valign="top"></td><td valign="top"><em>ks1</em>&nbsp;</td><td>key schedule to use </td></tr>
344    <tr><td valign="top"></td><td valign="top"><em>ks2</em>&nbsp;</td><td>key schedule to use </td></tr>
345    <tr><td valign="top"></td><td valign="top"><em>ks3</em>&nbsp;</td><td>key schedule to use </td></tr>
346    <tr><td valign="top"></td><td valign="top"><em>encp</em>&nbsp;</td><td>if non zero, encrypt. if zero, decrypt. </td></tr>
347  </table>
348</dl>
349
350</div>
351</div><p>
352<a class="anchor" name="ga5cf9203994e3a5ece2ef7a85e7a2875"></a><!-- doxytag: member="des.c::DES_ecb_encrypt" ref="ga5cf9203994e3a5ece2ef7a85e7a2875" args="(DES_cblock *input, DES_cblock *output, DES_key_schedule *ks, int encp)" -->
353<div class="memitem">
354<div class="memproto">
355      <table class="memname">
356        <tr>
357          <td class="memname">void DES_ecb_encrypt           </td>
358          <td>(</td>
359          <td class="paramtype">DES_cblock *&nbsp;</td>
360          <td class="paramname"> <em>input</em>, </td>
361        </tr>
362        <tr>
363          <td class="paramkey"></td>
364          <td></td>
365          <td class="paramtype">DES_cblock *&nbsp;</td>
366          <td class="paramname"> <em>output</em>, </td>
367        </tr>
368        <tr>
369          <td class="paramkey"></td>
370          <td></td>
371          <td class="paramtype">DES_key_schedule *&nbsp;</td>
372          <td class="paramname"> <em>ks</em>, </td>
373        </tr>
374        <tr>
375          <td class="paramkey"></td>
376          <td></td>
377          <td class="paramtype">int&nbsp;</td>
378          <td class="paramname"> <em>encp</em></td><td>&nbsp;</td>
379        </tr>
380        <tr>
381          <td></td>
382          <td>)</td>
383          <td></td><td></td><td></td>
384        </tr>
385      </table>
386</div>
387<div class="memdoc">
388
389<p>
390Encrypt/decrypt a block using DES.<p>
391<dl compact><dt><b>Parameters:</b></dt><dd>
392  <table border="0" cellspacing="2" cellpadding="0">
393    <tr><td valign="top"></td><td valign="top"><em>input</em>&nbsp;</td><td>data to encrypt </td></tr>
394    <tr><td valign="top"></td><td valign="top"><em>output</em>&nbsp;</td><td>data to encrypt </td></tr>
395    <tr><td valign="top"></td><td valign="top"><em>ks</em>&nbsp;</td><td>key schedule to use </td></tr>
396    <tr><td valign="top"></td><td valign="top"><em>encp</em>&nbsp;</td><td>if non zero, encrypt. if zero, decrypt. </td></tr>
397  </table>
398</dl>
399
400</div>
401</div><p>
402<a class="anchor" name="g36a83e8a4de4ac0f93ea932229dc3607"></a><!-- doxytag: member="des.c::DES_ede3_cbc_encrypt" ref="g36a83e8a4de4ac0f93ea932229dc3607" args="(const void *in, void *out, long length, DES_key_schedule *ks1, DES_key_schedule *ks2, DES_key_schedule *ks3, DES_cblock *iv, int encp)" -->
403<div class="memitem">
404<div class="memproto">
405      <table class="memname">
406        <tr>
407          <td class="memname">void DES_ede3_cbc_encrypt           </td>
408          <td>(</td>
409          <td class="paramtype">const void *&nbsp;</td>
410          <td class="paramname"> <em>in</em>, </td>
411        </tr>
412        <tr>
413          <td class="paramkey"></td>
414          <td></td>
415          <td class="paramtype">void *&nbsp;</td>
416          <td class="paramname"> <em>out</em>, </td>
417        </tr>
418        <tr>
419          <td class="paramkey"></td>
420          <td></td>
421          <td class="paramtype">long&nbsp;</td>
422          <td class="paramname"> <em>length</em>, </td>
423        </tr>
424        <tr>
425          <td class="paramkey"></td>
426          <td></td>
427          <td class="paramtype">DES_key_schedule *&nbsp;</td>
428          <td class="paramname"> <em>ks1</em>, </td>
429        </tr>
430        <tr>
431          <td class="paramkey"></td>
432          <td></td>
433          <td class="paramtype">DES_key_schedule *&nbsp;</td>
434          <td class="paramname"> <em>ks2</em>, </td>
435        </tr>
436        <tr>
437          <td class="paramkey"></td>
438          <td></td>
439          <td class="paramtype">DES_key_schedule *&nbsp;</td>
440          <td class="paramname"> <em>ks3</em>, </td>
441        </tr>
442        <tr>
443          <td class="paramkey"></td>
444          <td></td>
445          <td class="paramtype">DES_cblock *&nbsp;</td>
446          <td class="paramname"> <em>iv</em>, </td>
447        </tr>
448        <tr>
449          <td class="paramkey"></td>
450          <td></td>
451          <td class="paramtype">int&nbsp;</td>
452          <td class="paramname"> <em>encp</em></td><td>&nbsp;</td>
453        </tr>
454        <tr>
455          <td></td>
456          <td>)</td>
457          <td></td><td></td><td></td>
458        </tr>
459      </table>
460</div>
461<div class="memdoc">
462
463<p>
464Encrypt/decrypt using Triple DES in Chain Block Cipher mode (cbc).<p>
465The IV must always be diffrent for diffrent input data blocks.<p>
466<dl compact><dt><b>Parameters:</b></dt><dd>
467  <table border="0" cellspacing="2" cellpadding="0">
468    <tr><td valign="top"></td><td valign="top"><em>in</em>&nbsp;</td><td>data to encrypt </td></tr>
469    <tr><td valign="top"></td><td valign="top"><em>out</em>&nbsp;</td><td>data to encrypt </td></tr>
470    <tr><td valign="top"></td><td valign="top"><em>length</em>&nbsp;</td><td>length of data </td></tr>
471    <tr><td valign="top"></td><td valign="top"><em>ks1</em>&nbsp;</td><td>key schedule to use </td></tr>
472    <tr><td valign="top"></td><td valign="top"><em>ks2</em>&nbsp;</td><td>key schedule to use </td></tr>
473    <tr><td valign="top"></td><td valign="top"><em>ks3</em>&nbsp;</td><td>key schedule to use </td></tr>
474    <tr><td valign="top"></td><td valign="top"><em>iv</em>&nbsp;</td><td>initial vector to use </td></tr>
475    <tr><td valign="top"></td><td valign="top"><em>encp</em>&nbsp;</td><td>if non zero, encrypt. if zero, decrypt. </td></tr>
476  </table>
477</dl>
478
479</div>
480</div><p>
481<a class="anchor" name="g39662a8c2218601d402a895f08813662"></a><!-- doxytag: member="des.c::DES_encrypt" ref="g39662a8c2218601d402a895f08813662" args="(uint32_t u[2], DES_key_schedule *ks, int encp)" -->
482<div class="memitem">
483<div class="memproto">
484      <table class="memname">
485        <tr>
486          <td class="memname">void DES_encrypt           </td>
487          <td>(</td>
488          <td class="paramtype">uint32_t&nbsp;</td>
489          <td class="paramname"> <em>u</em>[2], </td>
490        </tr>
491        <tr>
492          <td class="paramkey"></td>
493          <td></td>
494          <td class="paramtype">DES_key_schedule *&nbsp;</td>
495          <td class="paramname"> <em>ks</em>, </td>
496        </tr>
497        <tr>
498          <td class="paramkey"></td>
499          <td></td>
500          <td class="paramtype">int&nbsp;</td>
501          <td class="paramname"> <em>encp</em></td><td>&nbsp;</td>
502        </tr>
503        <tr>
504          <td></td>
505          <td>)</td>
506          <td></td><td></td><td></td>
507        </tr>
508      </table>
509</div>
510<div class="memdoc">
511
512<p>
513Encrypt/decrypt a block using DES. Also called ECB mode<p>
514<dl compact><dt><b>Parameters:</b></dt><dd>
515  <table border="0" cellspacing="2" cellpadding="0">
516    <tr><td valign="top"></td><td valign="top"><em>u</em>&nbsp;</td><td>data to encrypt </td></tr>
517    <tr><td valign="top"></td><td valign="top"><em>ks</em>&nbsp;</td><td>key schedule to use </td></tr>
518    <tr><td valign="top"></td><td valign="top"><em>encp</em>&nbsp;</td><td>if non zero, encrypt. if zero, decrypt. </td></tr>
519  </table>
520</dl>
521
522</div>
523</div><p>
524<a class="anchor" name="g45739e74db49d07bfaa0d7918efd4875"></a><!-- doxytag: member="rnd_keys.c::DES_init_random_number_generator" ref="g45739e74db49d07bfaa0d7918efd4875" args="(DES_cblock *seed)" -->
525<div class="memitem">
526<div class="memproto">
527      <table class="memname">
528        <tr>
529          <td class="memname">void HC_DEPRECATED DES_init_random_number_generator           </td>
530          <td>(</td>
531          <td class="paramtype">DES_cblock *&nbsp;</td>
532          <td class="paramname"> <em>seed</em>          </td>
533          <td>&nbsp;)&nbsp;</td>
534          <td></td>
535        </tr>
536      </table>
537</div>
538<div class="memdoc">
539
540<p>
541Seed the random number generator. Deprecated, use <a class="el" href="page_rand.html">RAND - random number</a><p>
542<dl compact><dt><b>Parameters:</b></dt><dd>
543  <table border="0" cellspacing="2" cellpadding="0">
544    <tr><td valign="top"></td><td valign="top"><em>seed</em>&nbsp;</td><td>a seed to seed that random number generate with. </td></tr>
545  </table>
546</dl>
547
548</div>
549</div><p>
550<a class="anchor" name="g0d8a49cafee4be6cd3922bfb6323fd2d"></a><!-- doxytag: member="des.c::DES_is_weak_key" ref="g0d8a49cafee4be6cd3922bfb6323fd2d" args="(DES_cblock *key)" -->
551<div class="memitem">
552<div class="memproto">
553      <table class="memname">
554        <tr>
555          <td class="memname">int DES_is_weak_key           </td>
556          <td>(</td>
557          <td class="paramtype">DES_cblock *&nbsp;</td>
558          <td class="paramname"> <em>key</em>          </td>
559          <td>&nbsp;)&nbsp;</td>
560          <td></td>
561        </tr>
562      </table>
563</div>
564<div class="memdoc">
565
566<p>
567Checks if the key is any of the weaks keys that makes DES attacks trival.<p>
568<dl compact><dt><b>Parameters:</b></dt><dd>
569  <table border="0" cellspacing="2" cellpadding="0">
570    <tr><td valign="top"></td><td valign="top"><em>key</em>&nbsp;</td><td>key to check.</td></tr>
571  </table>
572</dl>
573<dl class="return" compact><dt><b>Returns:</b></dt><dd>1 if the key is weak, 0 otherwise. </dd></dl>
574
575</div>
576</div><p>
577<a class="anchor" name="gf5b4967f13a4a52c214c28b6e57a3a95"></a><!-- doxytag: member="des.c::DES_key_sched" ref="gf5b4967f13a4a52c214c28b6e57a3a95" args="(DES_cblock *key, DES_key_schedule *ks)" -->
578<div class="memitem">
579<div class="memproto">
580      <table class="memname">
581        <tr>
582          <td class="memname">int DES_key_sched           </td>
583          <td>(</td>
584          <td class="paramtype">DES_cblock *&nbsp;</td>
585          <td class="paramname"> <em>key</em>, </td>
586        </tr>
587        <tr>
588          <td class="paramkey"></td>
589          <td></td>
590          <td class="paramtype">DES_key_schedule *&nbsp;</td>
591          <td class="paramname"> <em>ks</em></td><td>&nbsp;</td>
592        </tr>
593        <tr>
594          <td></td>
595          <td>)</td>
596          <td></td><td></td><td></td>
597        </tr>
598      </table>
599</div>
600<div class="memdoc">
601
602<p>
603Compatibility function for eay libdes, works just like <a class="el" href="group__hcrypto__des.html#g3157dd2419a25cd4381867f012117d07">DES_set_key_checked()</a>.<p>
604<dl compact><dt><b>Parameters:</b></dt><dd>
605  <table border="0" cellspacing="2" cellpadding="0">
606    <tr><td valign="top"></td><td valign="top"><em>key</em>&nbsp;</td><td>a key to initialize the key schedule with. </td></tr>
607    <tr><td valign="top"></td><td valign="top"><em>ks</em>&nbsp;</td><td>a key schedule to initialize.</td></tr>
608  </table>
609</dl>
610<dl class="return" compact><dt><b>Returns:</b></dt><dd>0 on success, -1 on invalid parity, -2 on weak key. </dd></dl>
611
612</div>
613</div><p>
614<a class="anchor" name="gcd3642bcd8a7e93ea977786e5b540d5f"></a><!-- doxytag: member="rnd_keys.c::DES_new_random_key" ref="gcd3642bcd8a7e93ea977786e5b540d5f" args="(DES_cblock *key)" -->
615<div class="memitem">
616<div class="memproto">
617      <table class="memname">
618        <tr>
619          <td class="memname">int HC_DEPRECATED DES_new_random_key           </td>
620          <td>(</td>
621          <td class="paramtype">DES_cblock *&nbsp;</td>
622          <td class="paramname"> <em>key</em>          </td>
623          <td>&nbsp;)&nbsp;</td>
624          <td></td>
625        </tr>
626      </table>
627</div>
628<div class="memdoc">
629
630<p>
631Generate a random des key using a random block, fixup parity and skip weak keys.<p>
632<dl compact><dt><b>Parameters:</b></dt><dd>
633  <table border="0" cellspacing="2" cellpadding="0">
634    <tr><td valign="top"></td><td valign="top"><em>key</em>&nbsp;</td><td>is set to a random key.</td></tr>
635  </table>
636</dl>
637<dl class="return" compact><dt><b>Returns:</b></dt><dd>0 on success, non zero on random number generator failure. </dd></dl>
638
639</div>
640</div><p>
641<a class="anchor" name="g336e497f66748e92b93fc0b4512d78c2"></a><!-- doxytag: member="des.c::DES_pcbc_encrypt" ref="g336e497f66748e92b93fc0b4512d78c2" args="(const void *in, void *out, long length, DES_key_schedule *ks, DES_cblock *iv, int encp)" -->
642<div class="memitem">
643<div class="memproto">
644      <table class="memname">
645        <tr>
646          <td class="memname">void DES_pcbc_encrypt           </td>
647          <td>(</td>
648          <td class="paramtype">const void *&nbsp;</td>
649          <td class="paramname"> <em>in</em>, </td>
650        </tr>
651        <tr>
652          <td class="paramkey"></td>
653          <td></td>
654          <td class="paramtype">void *&nbsp;</td>
655          <td class="paramname"> <em>out</em>, </td>
656        </tr>
657        <tr>
658          <td class="paramkey"></td>
659          <td></td>
660          <td class="paramtype">long&nbsp;</td>
661          <td class="paramname"> <em>length</em>, </td>
662        </tr>
663        <tr>
664          <td class="paramkey"></td>
665          <td></td>
666          <td class="paramtype">DES_key_schedule *&nbsp;</td>
667          <td class="paramname"> <em>ks</em>, </td>
668        </tr>
669        <tr>
670          <td class="paramkey"></td>
671          <td></td>
672          <td class="paramtype">DES_cblock *&nbsp;</td>
673          <td class="paramname"> <em>iv</em>, </td>
674        </tr>
675        <tr>
676          <td class="paramkey"></td>
677          <td></td>
678          <td class="paramtype">int&nbsp;</td>
679          <td class="paramname"> <em>encp</em></td><td>&nbsp;</td>
680        </tr>
681        <tr>
682          <td></td>
683          <td>)</td>
684          <td></td><td></td><td></td>
685        </tr>
686      </table>
687</div>
688<div class="memdoc">
689
690<p>
691Encrypt/decrypt a block using DES in Propagating Cipher Block Chaining mode. This mode is only used for Kerberos 4, and it should stay that way.<p>
692The IV must always be diffrent for diffrent input data blocks.<p>
693<dl compact><dt><b>Parameters:</b></dt><dd>
694  <table border="0" cellspacing="2" cellpadding="0">
695    <tr><td valign="top"></td><td valign="top"><em>in</em>&nbsp;</td><td>data to encrypt </td></tr>
696    <tr><td valign="top"></td><td valign="top"><em>out</em>&nbsp;</td><td>data to encrypt </td></tr>
697    <tr><td valign="top"></td><td valign="top"><em>length</em>&nbsp;</td><td>length of data </td></tr>
698    <tr><td valign="top"></td><td valign="top"><em>ks</em>&nbsp;</td><td>key schedule to use </td></tr>
699    <tr><td valign="top"></td><td valign="top"><em>iv</em>&nbsp;</td><td>initial vector to use </td></tr>
700    <tr><td valign="top"></td><td valign="top"><em>encp</em>&nbsp;</td><td>if non zero, encrypt. if zero, decrypt. </td></tr>
701  </table>
702</dl>
703
704</div>
705</div><p>
706<a class="anchor" name="gd70d485549f7444589f3283e938c0258"></a><!-- doxytag: member="rnd_keys.c::DES_random_key" ref="gd70d485549f7444589f3283e938c0258" args="(DES_cblock *key)" -->
707<div class="memitem">
708<div class="memproto">
709      <table class="memname">
710        <tr>
711          <td class="memname">void HC_DEPRECATED DES_random_key           </td>
712          <td>(</td>
713          <td class="paramtype">DES_cblock *&nbsp;</td>
714          <td class="paramname"> <em>key</em>          </td>
715          <td>&nbsp;)&nbsp;</td>
716          <td></td>
717        </tr>
718      </table>
719</div>
720<div class="memdoc">
721
722<p>
723Generate a random key, deprecated since it doesn't return an error code, use <a class="el" href="group__hcrypto__des.html#gcd3642bcd8a7e93ea977786e5b540d5f">DES_new_random_key()</a>.<p>
724<dl compact><dt><b>Parameters:</b></dt><dd>
725  <table border="0" cellspacing="2" cellpadding="0">
726    <tr><td valign="top"></td><td valign="top"><em>key</em>&nbsp;</td><td>is set to a random key. </td></tr>
727  </table>
728</dl>
729
730</div>
731</div><p>
732<a class="anchor" name="gad10e059974f3048b3de49599989486b"></a><!-- doxytag: member="des.c::DES_set_key" ref="gad10e059974f3048b3de49599989486b" args="(DES_cblock *key, DES_key_schedule *ks)" -->
733<div class="memitem">
734<div class="memproto">
735      <table class="memname">
736        <tr>
737          <td class="memname">int HC_DEPRECATED DES_set_key           </td>
738          <td>(</td>
739          <td class="paramtype">DES_cblock *&nbsp;</td>
740          <td class="paramname"> <em>key</em>, </td>
741        </tr>
742        <tr>
743          <td class="paramkey"></td>
744          <td></td>
745          <td class="paramtype">DES_key_schedule *&nbsp;</td>
746          <td class="paramname"> <em>ks</em></td><td>&nbsp;</td>
747        </tr>
748        <tr>
749          <td></td>
750          <td>)</td>
751          <td></td><td></td><td></td>
752        </tr>
753      </table>
754</div>
755<div class="memdoc">
756
757<p>
758Setup a des key schedule from a key. Deprecated function, use <a class="el" href="group__hcrypto__des.html#g8131d59b5c0f65ca8bba0873932680d5">DES_set_key_unchecked()</a> or <a class="el" href="group__hcrypto__des.html#g3157dd2419a25cd4381867f012117d07">DES_set_key_checked()</a> instead.<p>
759<dl compact><dt><b>Parameters:</b></dt><dd>
760  <table border="0" cellspacing="2" cellpadding="0">
761    <tr><td valign="top"></td><td valign="top"><em>key</em>&nbsp;</td><td>a key to initialize the key schedule with. </td></tr>
762    <tr><td valign="top"></td><td valign="top"><em>ks</em>&nbsp;</td><td>a key schedule to initialize.</td></tr>
763  </table>
764</dl>
765<dl class="return" compact><dt><b>Returns:</b></dt><dd>0 on success </dd></dl>
766
767</div>
768</div><p>
769<a class="anchor" name="g3157dd2419a25cd4381867f012117d07"></a><!-- doxytag: member="des.c::DES_set_key_checked" ref="g3157dd2419a25cd4381867f012117d07" args="(DES_cblock *key, DES_key_schedule *ks)" -->
770<div class="memitem">
771<div class="memproto">
772      <table class="memname">
773        <tr>
774          <td class="memname">int DES_set_key_checked           </td>
775          <td>(</td>
776          <td class="paramtype">DES_cblock *&nbsp;</td>
777          <td class="paramname"> <em>key</em>, </td>
778        </tr>
779        <tr>
780          <td class="paramkey"></td>
781          <td></td>
782          <td class="paramtype">DES_key_schedule *&nbsp;</td>
783          <td class="paramname"> <em>ks</em></td><td>&nbsp;</td>
784        </tr>
785        <tr>
786          <td></td>
787          <td>)</td>
788          <td></td><td></td><td></td>
789        </tr>
790      </table>
791</div>
792<div class="memdoc">
793
794<p>
795Just like <a class="el" href="group__hcrypto__des.html#g8131d59b5c0f65ca8bba0873932680d5">DES_set_key_unchecked()</a> except checking that the key is not weak for or have correct parity.<p>
796<dl compact><dt><b>Parameters:</b></dt><dd>
797  <table border="0" cellspacing="2" cellpadding="0">
798    <tr><td valign="top"></td><td valign="top"><em>key</em>&nbsp;</td><td>a key to initialize the key schedule with. </td></tr>
799    <tr><td valign="top"></td><td valign="top"><em>ks</em>&nbsp;</td><td>a key schedule to initialize.</td></tr>
800  </table>
801</dl>
802<dl class="return" compact><dt><b>Returns:</b></dt><dd>0 on success, -1 on invalid parity, -2 on weak key. </dd></dl>
803
804</div>
805</div><p>
806<a class="anchor" name="g8131d59b5c0f65ca8bba0873932680d5"></a><!-- doxytag: member="des.c::DES_set_key_unchecked" ref="g8131d59b5c0f65ca8bba0873932680d5" args="(DES_cblock *key, DES_key_schedule *ks)" -->
807<div class="memitem">
808<div class="memproto">
809      <table class="memname">
810        <tr>
811          <td class="memname">int DES_set_key_unchecked           </td>
812          <td>(</td>
813          <td class="paramtype">DES_cblock *&nbsp;</td>
814          <td class="paramname"> <em>key</em>, </td>
815        </tr>
816        <tr>
817          <td class="paramkey"></td>
818          <td></td>
819          <td class="paramtype">DES_key_schedule *&nbsp;</td>
820          <td class="paramname"> <em>ks</em></td><td>&nbsp;</td>
821        </tr>
822        <tr>
823          <td></td>
824          <td>)</td>
825          <td></td><td></td><td></td>
826        </tr>
827      </table>
828</div>
829<div class="memdoc">
830
831<p>
832Setup a des key schedule from a key. The key is no longer needed after this transaction and can cleared.<p>
833Does NOT check that the key is weak for or have wrong parity.<p>
834<dl compact><dt><b>Parameters:</b></dt><dd>
835  <table border="0" cellspacing="2" cellpadding="0">
836    <tr><td valign="top"></td><td valign="top"><em>key</em>&nbsp;</td><td>a key to initialize the key schedule with. </td></tr>
837    <tr><td valign="top"></td><td valign="top"><em>ks</em>&nbsp;</td><td>a key schedule to initialize.</td></tr>
838  </table>
839</dl>
840<dl class="return" compact><dt><b>Returns:</b></dt><dd>0 on success </dd></dl>
841
842</div>
843</div><p>
844<a class="anchor" name="g4179bef43ceb72cc2034f39e7d2d5ae4"></a><!-- doxytag: member="des.c::DES_set_odd_parity" ref="g4179bef43ceb72cc2034f39e7d2d5ae4" args="(DES_cblock *key)" -->
845<div class="memitem">
846<div class="memproto">
847      <table class="memname">
848        <tr>
849          <td class="memname">void DES_set_odd_parity           </td>
850          <td>(</td>
851          <td class="paramtype">DES_cblock *&nbsp;</td>
852          <td class="paramname"> <em>key</em>          </td>
853          <td>&nbsp;)&nbsp;</td>
854          <td></td>
855        </tr>
856      </table>
857</div>
858<div class="memdoc">
859
860<p>
861Set the parity of the key block, used to generate a des key from a random key. See <a class="el" href="page_des.html#des_keygen">DES key generation</a>.<p>
862<dl compact><dt><b>Parameters:</b></dt><dd>
863  <table border="0" cellspacing="2" cellpadding="0">
864    <tr><td valign="top"></td><td valign="top"><em>key</em>&nbsp;</td><td>key to fixup the parity for. </td></tr>
865  </table>
866</dl>
867
868</div>
869</div><p>
870<a class="anchor" name="g60893cdc75d9ce8cbf4a5d7a874855c8"></a><!-- doxytag: member="des.c::DES_string_to_key" ref="g60893cdc75d9ce8cbf4a5d7a874855c8" args="(const char *str, DES_cblock *key)" -->
871<div class="memitem">
872<div class="memproto">
873      <table class="memname">
874        <tr>
875          <td class="memname">void DES_string_to_key           </td>
876          <td>(</td>
877          <td class="paramtype">const char *&nbsp;</td>
878          <td class="paramname"> <em>str</em>, </td>
879        </tr>
880        <tr>
881          <td class="paramkey"></td>
882          <td></td>
883          <td class="paramtype">DES_cblock *&nbsp;</td>
884          <td class="paramname"> <em>key</em></td><td>&nbsp;</td>
885        </tr>
886        <tr>
887          <td></td>
888          <td>)</td>
889          <td></td><td></td><td></td>
890        </tr>
891      </table>
892</div>
893<div class="memdoc">
894
895<p>
896Convert a string to a DES key. Use something like <a class="el" href="group__hcrypto__misc.html#gece1627cc5535ef7b5e86e2f5a3eec04">PKCS5_PBKDF2_HMAC_SHA1()</a> to create key from passwords.<p>
897<dl compact><dt><b>Parameters:</b></dt><dd>
898  <table border="0" cellspacing="2" cellpadding="0">
899    <tr><td valign="top"></td><td valign="top"><em>str</em>&nbsp;</td><td>The string to convert to a key </td></tr>
900    <tr><td valign="top"></td><td valign="top"><em>key</em>&nbsp;</td><td>the resulting key </td></tr>
901  </table>
902</dl>
903
904</div>
905</div><p>
906</div>
907<hr size="1"><address style="text-align: right;"><small>
908Generated 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>
909</body>
910</html>
911