<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>Heimdal crypto library: DES crypto functions</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
<link href="tabs.css" rel="stylesheet" type="text/css">
</head><body>
<p>
<a href="http://www.h5l.org/"><img src="http://www.h5l.org/keyhole-heimdal.png" alt="keyhole logo"/></a>
</p>
<!-- end of header marker -->
<!-- Generated by Doxygen 1.5.6 -->
<div class="navigation" id="top">
<div class="tabs">
<ul>
<li><a href="index.html"><span>Main Page</span></a></li>
<li><a href="modules.html"><span>Modules</span></a></li>
<li><a href="examples.html"><span>Examples</span></a></li>
</ul>
</div>
</div>
<div class="contents">
<h1>DES crypto functions</h1><table border="0" cellpadding="0" cellspacing="0">
<tr><td></td></tr>
<tr><td colspan="2"><br><h2>Functions</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void </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>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int HC_DEPRECATED </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>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int </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>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int HC_DEPRECATED </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>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int </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>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int </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>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int </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>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void </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>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void </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>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void </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>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void </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>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void </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>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void </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>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void </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>
<tr><td class="memItemLeft" nowrap align="right" valign="top">uint32_t </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>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void </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>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int HC_DEPRECATED </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>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void HC_DEPRECATED </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>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void HC_DEPRECATED </td><td class="memItemRight" valign="bottom"><a class="el" href="group__hcrypto__des.html#gd70d485549f7444589f3283e938c0258">DES_random_key</a> (DES_cblock *key)</td></tr>
</table>
<hr><a name="_details"></a><h2>Detailed Description</h2>
See the <a class="el" href="page_des.html">DES - Data Encryption Standard crypto interface</a> for description and examples. <hr><h2>Function Documentation</h2>
<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)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">uint32_t DES_cbc_cksum </td>
<td>(</td>
<td class="paramtype">const void * </td>
<td class="paramname"> <em>in</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">DES_cblock * </td>
<td class="paramname"> <em>output</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">long </td>
<td class="paramname"> <em>length</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">DES_key_schedule * </td>
<td class="paramname"> <em>ks</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">DES_cblock * </td>
<td class="paramname"> <em>iv</em></td><td> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Crete a checksum using DES in CBC encryption mode. This mode is only used for Kerberos 4, and it should stay that way.<p>
The IV must always be diffrent for diffrent input data blocks.<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>in</em> </td><td>data to checksum </td></tr>
<tr><td valign="top"></td><td valign="top"><em>output</em> </td><td>the checksum </td></tr>
<tr><td valign="top"></td><td valign="top"><em>length</em> </td><td>length of data </td></tr>
<tr><td valign="top"></td><td valign="top"><em>ks</em> </td><td>key schedule to use </td></tr>
<tr><td valign="top"></td><td valign="top"><em>iv</em> </td><td>initial vector to use </td></tr>
</table>
</dl>
</div>
</div><p>
<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)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void DES_cbc_encrypt </td>
<td>(</td>
<td class="paramtype">const void * </td>
<td class="paramname"> <em>in</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">void * </td>
<td class="paramname"> <em>out</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">long </td>
<td class="paramname"> <em>length</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">DES_key_schedule * </td>
<td class="paramname"> <em>ks</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">DES_cblock * </td>
<td class="paramname"> <em>iv</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int </td>
<td class="paramname"> <em>encp</em></td><td> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Encrypt/decrypt a block using DES in Chain Block Cipher mode (cbc).<p>
The IV must always be diffrent for diffrent input data blocks.<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>in</em> </td><td>data to encrypt </td></tr>
<tr><td valign="top"></td><td valign="top"><em>out</em> </td><td>data to encrypt </td></tr>
<tr><td valign="top"></td><td valign="top"><em>length</em> </td><td>length of data </td></tr>
<tr><td valign="top"></td><td valign="top"><em>ks</em> </td><td>key schedule to use </td></tr>
<tr><td valign="top"></td><td valign="top"><em>iv</em> </td><td>initial vector to use </td></tr>
<tr><td valign="top"></td><td valign="top"><em>encp</em> </td><td>if non zero, encrypt. if zero, decrypt. </td></tr>
</table>
</dl>
</div>
</div><p>
<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)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void DES_cfb64_encrypt </td>
<td>(</td>
<td class="paramtype">const void * </td>
<td class="paramname"> <em>in</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">void * </td>
<td class="paramname"> <em>out</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">long </td>
<td class="paramname"> <em>length</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">DES_key_schedule * </td>
<td class="paramname"> <em>ks</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">DES_cblock * </td>
<td class="paramname"> <em>iv</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int * </td>
<td class="paramname"> <em>num</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int </td>
<td class="paramname"> <em>encp</em></td><td> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Encrypt/decrypt using DES in cipher feedback mode with 64 bit feedback.<p>
The IV must always be diffrent for diffrent input data blocks.<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>in</em> </td><td>data to encrypt </td></tr>
<tr><td valign="top"></td><td valign="top"><em>out</em> </td><td>data to encrypt </td></tr>
<tr><td valign="top"></td><td valign="top"><em>length</em> </td><td>length of data </td></tr>
<tr><td valign="top"></td><td valign="top"><em>ks</em> </td><td>key schedule to use </td></tr>
<tr><td valign="top"></td><td valign="top"><em>iv</em> </td><td>initial vector to use </td></tr>
<tr><td valign="top"></td><td valign="top"><em>num</em> </td><td>offset into in cipher block encryption/decryption stop last time. </td></tr>
<tr><td valign="top"></td><td valign="top"><em>encp</em> </td><td>if non zero, encrypt. if zero, decrypt. </td></tr>
</table>
</dl>
</div>
</div><p>
<a class="anchor" name="gcf0d611296ad70edf90a3130b2f62c71"></a><!-- doxytag: member="des.c::DES_check_key_parity" ref="gcf0d611296ad70edf90a3130b2f62c71" args="(DES_cblock *key)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int HC_DEPRECATED DES_check_key_parity </td>
<td>(</td>
<td class="paramtype">DES_cblock * </td>
<td class="paramname"> <em>key</em> </td>
<td> ) </td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Check if the key have correct parity.<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>key</em> </td><td>key to check the parity. </td></tr>
</table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>1 on success, 0 on failure. </dd></dl>
</div>
</div><p>
<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)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void DES_ecb3_encrypt </td>
<td>(</td>
<td class="paramtype">DES_cblock * </td>
<td class="paramname"> <em>input</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">DES_cblock * </td>
<td class="paramname"> <em>output</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">DES_key_schedule * </td>
<td class="paramname"> <em>ks1</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">DES_key_schedule * </td>
<td class="paramname"> <em>ks2</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">DES_key_schedule * </td>
<td class="paramname"> <em>ks3</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int </td>
<td class="paramname"> <em>encp</em></td><td> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Encrypt/decrypt a block using triple DES using EDE mode, encrypt/decrypt/encrypt.<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>input</em> </td><td>data to encrypt </td></tr>
<tr><td valign="top"></td><td valign="top"><em>output</em> </td><td>data to encrypt </td></tr>
<tr><td valign="top"></td><td valign="top"><em>ks1</em> </td><td>key schedule to use </td></tr>
<tr><td valign="top"></td><td valign="top"><em>ks2</em> </td><td>key schedule to use </td></tr>
<tr><td valign="top"></td><td valign="top"><em>ks3</em> </td><td>key schedule to use </td></tr>
<tr><td valign="top"></td><td valign="top"><em>encp</em> </td><td>if non zero, encrypt. if zero, decrypt. </td></tr>
</table>
</dl>
</div>
</div><p>
<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)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void DES_ecb_encrypt </td>
<td>(</td>
<td class="paramtype">DES_cblock * </td>
<td class="paramname"> <em>input</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">DES_cblock * </td>
<td class="paramname"> <em>output</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">DES_key_schedule * </td>
<td class="paramname"> <em>ks</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int </td>
<td class="paramname"> <em>encp</em></td><td> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Encrypt/decrypt a block using DES.<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>input</em> </td><td>data to encrypt </td></tr>
<tr><td valign="top"></td><td valign="top"><em>output</em> </td><td>data to encrypt </td></tr>
<tr><td valign="top"></td><td valign="top"><em>ks</em> </td><td>key schedule to use </td></tr>
<tr><td valign="top"></td><td valign="top"><em>encp</em> </td><td>if non zero, encrypt. if zero, decrypt. </td></tr>
</table>
</dl>
</div>
</div><p>
<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)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void DES_ede3_cbc_encrypt </td>
<td>(</td>
<td class="paramtype">const void * </td>
<td class="paramname"> <em>in</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">void * </td>
<td class="paramname"> <em>out</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">long </td>
<td class="paramname"> <em>length</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">DES_key_schedule * </td>
<td class="paramname"> <em>ks1</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">DES_key_schedule * </td>
<td class="paramname"> <em>ks2</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">DES_key_schedule * </td>
<td class="paramname"> <em>ks3</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">DES_cblock * </td>
<td class="paramname"> <em>iv</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int </td>
<td class="paramname"> <em>encp</em></td><td> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Encrypt/decrypt using Triple DES in Chain Block Cipher mode (cbc).<p>
The IV must always be diffrent for diffrent input data blocks.<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>in</em> </td><td>data to encrypt </td></tr>
<tr><td valign="top"></td><td valign="top"><em>out</em> </td><td>data to encrypt </td></tr>
<tr><td valign="top"></td><td valign="top"><em>length</em> </td><td>length of data </td></tr>
<tr><td valign="top"></td><td valign="top"><em>ks1</em> </td><td>key schedule to use </td></tr>
<tr><td valign="top"></td><td valign="top"><em>ks2</em> </td><td>key schedule to use </td></tr>
<tr><td valign="top"></td><td valign="top"><em>ks3</em> </td><td>key schedule to use </td></tr>
<tr><td valign="top"></td><td valign="top"><em>iv</em> </td><td>initial vector to use </td></tr>
<tr><td valign="top"></td><td valign="top"><em>encp</em> </td><td>if non zero, encrypt. if zero, decrypt. </td></tr>
</table>
</dl>
</div>
</div><p>
<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)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void DES_encrypt </td>
<td>(</td>
<td class="paramtype">uint32_t </td>
<td class="paramname"> <em>u</em>[2], </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">DES_key_schedule * </td>
<td class="paramname"> <em>ks</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int </td>
<td class="paramname"> <em>encp</em></td><td> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Encrypt/decrypt a block using DES. Also called ECB mode<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>u</em> </td><td>data to encrypt </td></tr>
<tr><td valign="top"></td><td valign="top"><em>ks</em> </td><td>key schedule to use </td></tr>
<tr><td valign="top"></td><td valign="top"><em>encp</em> </td><td>if non zero, encrypt. if zero, decrypt. </td></tr>
</table>
</dl>
</div>
</div><p>
<a class="anchor" name="g45739e74db49d07bfaa0d7918efd4875"></a><!-- doxytag: member="rnd_keys.c::DES_init_random_number_generator" ref="g45739e74db49d07bfaa0d7918efd4875" args="(DES_cblock *seed)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void HC_DEPRECATED DES_init_random_number_generator </td>
<td>(</td>
<td class="paramtype">DES_cblock * </td>
<td class="paramname"> <em>seed</em> </td>
<td> ) </td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Seed the random number generator. Deprecated, use <a class="el" href="page_rand.html">RAND - random number</a><p>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>seed</em> </td><td>a seed to seed that random number generate with. </td></tr>
</table>
</dl>
</div>
</div><p>
<a class="anchor" name="g0d8a49cafee4be6cd3922bfb6323fd2d"></a><!-- doxytag: member="des.c::DES_is_weak_key" ref="g0d8a49cafee4be6cd3922bfb6323fd2d" args="(DES_cblock *key)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int DES_is_weak_key </td>
<td>(</td>
<td class="paramtype">DES_cblock * </td>
<td class="paramname"> <em>key</em> </td>
<td> ) </td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Checks if the key is any of the weaks keys that makes DES attacks trival.<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>key</em> </td><td>key to check.</td></tr>
</table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>1 if the key is weak, 0 otherwise. </dd></dl>
</div>
</div><p>
<a class="anchor" name="gf5b4967f13a4a52c214c28b6e57a3a95"></a><!-- doxytag: member="des.c::DES_key_sched" ref="gf5b4967f13a4a52c214c28b6e57a3a95" args="(DES_cblock *key, DES_key_schedule *ks)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int DES_key_sched </td>
<td>(</td>
<td class="paramtype">DES_cblock * </td>
<td class="paramname"> <em>key</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">DES_key_schedule * </td>
<td class="paramname"> <em>ks</em></td><td> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Compatibility function for eay libdes, works just like <a class="el" href="group__hcrypto__des.html#g3157dd2419a25cd4381867f012117d07">DES_set_key_checked()</a>.<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>key</em> </td><td>a key to initialize the key schedule with. </td></tr>
<tr><td valign="top"></td><td valign="top"><em>ks</em> </td><td>a key schedule to initialize.</td></tr>
</table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>0 on success, -1 on invalid parity, -2 on weak key. </dd></dl>
</div>
</div><p>
<a class="anchor" name="gcd3642bcd8a7e93ea977786e5b540d5f"></a><!-- doxytag: member="rnd_keys.c::DES_new_random_key" ref="gcd3642bcd8a7e93ea977786e5b540d5f" args="(DES_cblock *key)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int HC_DEPRECATED DES_new_random_key </td>
<td>(</td>
<td class="paramtype">DES_cblock * </td>
<td class="paramname"> <em>key</em> </td>
<td> ) </td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Generate a random des key using a random block, fixup parity and skip weak keys.<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>key</em> </td><td>is set to a random key.</td></tr>
</table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>0 on success, non zero on random number generator failure. </dd></dl>
</div>
</div><p>
<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)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void DES_pcbc_encrypt </td>
<td>(</td>
<td class="paramtype">const void * </td>
<td class="paramname"> <em>in</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">void * </td>
<td class="paramname"> <em>out</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">long </td>
<td class="paramname"> <em>length</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">DES_key_schedule * </td>
<td class="paramname"> <em>ks</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">DES_cblock * </td>
<td class="paramname"> <em>iv</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int </td>
<td class="paramname"> <em>encp</em></td><td> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Encrypt/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>
The IV must always be diffrent for diffrent input data blocks.<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>in</em> </td><td>data to encrypt </td></tr>
<tr><td valign="top"></td><td valign="top"><em>out</em> </td><td>data to encrypt </td></tr>
<tr><td valign="top"></td><td valign="top"><em>length</em> </td><td>length of data </td></tr>
<tr><td valign="top"></td><td valign="top"><em>ks</em> </td><td>key schedule to use </td></tr>
<tr><td valign="top"></td><td valign="top"><em>iv</em> </td><td>initial vector to use </td></tr>
<tr><td valign="top"></td><td valign="top"><em>encp</em> </td><td>if non zero, encrypt. if zero, decrypt. </td></tr>
</table>
</dl>
</div>
</div><p>
<a class="anchor" name="gd70d485549f7444589f3283e938c0258"></a><!-- doxytag: member="rnd_keys.c::DES_random_key" ref="gd70d485549f7444589f3283e938c0258" args="(DES_cblock *key)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void HC_DEPRECATED DES_random_key </td>
<td>(</td>
<td class="paramtype">DES_cblock * </td>
<td class="paramname"> <em>key</em> </td>
<td> ) </td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Generate 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>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>key</em> </td><td>is set to a random key. </td></tr>
</table>
</dl>
</div>
</div><p>
<a class="anchor" name="gad10e059974f3048b3de49599989486b"></a><!-- doxytag: member="des.c::DES_set_key" ref="gad10e059974f3048b3de49599989486b" args="(DES_cblock *key, DES_key_schedule *ks)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int HC_DEPRECATED DES_set_key </td>
<td>(</td>
<td class="paramtype">DES_cblock * </td>
<td class="paramname"> <em>key</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">DES_key_schedule * </td>
<td class="paramname"> <em>ks</em></td><td> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Setup 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>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>key</em> </td><td>a key to initialize the key schedule with. </td></tr>
<tr><td valign="top"></td><td valign="top"><em>ks</em> </td><td>a key schedule to initialize.</td></tr>
</table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>0 on success </dd></dl>
</div>
</div><p>
<a class="anchor" name="g3157dd2419a25cd4381867f012117d07"></a><!-- doxytag: member="des.c::DES_set_key_checked" ref="g3157dd2419a25cd4381867f012117d07" args="(DES_cblock *key, DES_key_schedule *ks)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int DES_set_key_checked </td>
<td>(</td>
<td class="paramtype">DES_cblock * </td>
<td class="paramname"> <em>key</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">DES_key_schedule * </td>
<td class="paramname"> <em>ks</em></td><td> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Just 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>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>key</em> </td><td>a key to initialize the key schedule with. </td></tr>
<tr><td valign="top"></td><td valign="top"><em>ks</em> </td><td>a key schedule to initialize.</td></tr>
</table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>0 on success, -1 on invalid parity, -2 on weak key. </dd></dl>
</div>
</div><p>
<a class="anchor" name="g8131d59b5c0f65ca8bba0873932680d5"></a><!-- doxytag: member="des.c::DES_set_key_unchecked" ref="g8131d59b5c0f65ca8bba0873932680d5" args="(DES_cblock *key, DES_key_schedule *ks)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int DES_set_key_unchecked </td>
<td>(</td>
<td class="paramtype">DES_cblock * </td>
<td class="paramname"> <em>key</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">DES_key_schedule * </td>
<td class="paramname"> <em>ks</em></td><td> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Setup a des key schedule from a key. The key is no longer needed after this transaction and can cleared.<p>
Does NOT check that the key is weak for or have wrong parity.<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>key</em> </td><td>a key to initialize the key schedule with. </td></tr>
<tr><td valign="top"></td><td valign="top"><em>ks</em> </td><td>a key schedule to initialize.</td></tr>
</table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>0 on success </dd></dl>
</div>
</div><p>
<a class="anchor" name="g4179bef43ceb72cc2034f39e7d2d5ae4"></a><!-- doxytag: member="des.c::DES_set_odd_parity" ref="g4179bef43ceb72cc2034f39e7d2d5ae4" args="(DES_cblock *key)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void DES_set_odd_parity </td>
<td>(</td>
<td class="paramtype">DES_cblock * </td>
<td class="paramname"> <em>key</em> </td>
<td> ) </td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Set 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>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>key</em> </td><td>key to fixup the parity for. </td></tr>
</table>
</dl>
</div>
</div><p>
<a class="anchor" name="g60893cdc75d9ce8cbf4a5d7a874855c8"></a><!-- doxytag: member="des.c::DES_string_to_key" ref="g60893cdc75d9ce8cbf4a5d7a874855c8" args="(const char *str, DES_cblock *key)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void DES_string_to_key </td>
<td>(</td>
<td class="paramtype">const char * </td>
<td class="paramname"> <em>str</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">DES_cblock * </td>
<td class="paramname"> <em>key</em></td><td> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Convert 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>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>str</em> </td><td>The string to convert to a key </td></tr>
<tr><td valign="top"></td><td valign="top"><em>key</em> </td><td>the resulting key </td></tr>
</table>
</dl>
</div>
</div><p>
</div>
<hr size="1"><address style="text-align: right;"><small>
Generated on Wed Jan 11 14:07:38 2012 for Heimdal crypto library by <a href="http://www.doxygen.org/index.html"><img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.6</small></address>
</body>
</html>