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