group__hcrypto__dh.html revision 226031
1226031Sstas<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> 2226031Sstas<html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8"> 3226031Sstas<title>Heimdal crypto library: Diffie-Hellman functions</title> 4226031Sstas<link href="doxygen.css" rel="stylesheet" type="text/css"> 5226031Sstas<link href="tabs.css" rel="stylesheet" type="text/css"> 6226031Sstas</head><body> 7226031Sstas<p> 8226031Sstas<a href="http://www.h5l.org/"><img src="http://www.h5l.org/keyhole-heimdal.png" alt="keyhole logo"/></a> 9226031Sstas</p> 10226031Sstas<!-- end of header marker --> 11226031Sstas<!-- Generated by Doxygen 1.5.6 --> 12226031Sstas<div class="navigation" id="top"> 13226031Sstas <div class="tabs"> 14226031Sstas <ul> 15226031Sstas <li><a href="index.html"><span>Main Page</span></a></li> 16226031Sstas <li><a href="modules.html"><span>Modules</span></a></li> 17226031Sstas <li><a href="examples.html"><span>Examples</span></a></li> 18226031Sstas </ul> 19226031Sstas </div> 20226031Sstas</div> 21226031Sstas<div class="contents"> 22226031Sstas<h1>Diffie-Hellman functions</h1><table border="0" cellpadding="0" cellspacing="0"> 23226031Sstas<tr><td></td></tr> 24226031Sstas<tr><td colspan="2"><br><h2>Functions</h2></td></tr> 25226031Sstas<tr><td class="memItemLeft" nowrap align="right" valign="top">const DH_METHOD * </td><td class="memItemRight" valign="bottom"><a class="el" href="group__hcrypto__dh.html#gbfe13af1fef654a94a9be268df6d8809">DH_ltm_method</a> (void)</td></tr> 26226031Sstas 27226031Sstas<tr><td class="memItemLeft" nowrap align="right" valign="top">DH * </td><td class="memItemRight" valign="bottom"><a class="el" href="group__hcrypto__dh.html#g76c6e12bd1f0b9977d80fee83b086031">DH_new</a> (void)</td></tr> 28226031Sstas 29226031Sstas<tr><td class="memItemLeft" nowrap align="right" valign="top">DH * </td><td class="memItemRight" valign="bottom"><a class="el" href="group__hcrypto__dh.html#g2e97e03aee56c6094bb7fd6322b3ce68">DH_new_method</a> (ENGINE *engine)</td></tr> 30226031Sstas 31226031Sstas<tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="group__hcrypto__dh.html#g1f15312ca21e290ee714e86578820c35">DH_free</a> (DH *dh)</td></tr> 32226031Sstas 33226031Sstas<tr><td class="memItemLeft" nowrap align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="group__hcrypto__dh.html#gf7c3e51cba326865c3684012c2337df1">DH_up_ref</a> (DH *dh)</td></tr> 34226031Sstas 35226031Sstas<tr><td class="memItemLeft" nowrap align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="group__hcrypto__dh.html#g9e1fdd62e3bfe4b671dbfc363f0e6297">DH_size</a> (const DH *dh)</td></tr> 36226031Sstas 37226031Sstas<tr><td class="memItemLeft" nowrap align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="group__hcrypto__dh.html#g7a03e7589a8473ed34cf2a4177709c0e">DH_set_ex_data</a> (DH *dh, int idx, void *data)</td></tr> 38226031Sstas 39226031Sstas<tr><td class="memItemLeft" nowrap align="right" valign="top">void * </td><td class="memItemRight" valign="bottom"><a class="el" href="group__hcrypto__dh.html#g25fff6e977829c49410f046b8cc3471d">DH_get_ex_data</a> (DH *dh, int idx)</td></tr> 40226031Sstas 41226031Sstas<tr><td class="memItemLeft" nowrap align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="group__hcrypto__dh.html#g11ef051e93bc408f3e7ba77d44c5d3cb">DH_generate_parameters_ex</a> (DH *dh, int prime_len, int generator, BN_GENCB *cb)</td></tr> 42226031Sstas 43226031Sstas<tr><td class="memItemLeft" nowrap align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="group__hcrypto__dh.html#g8995ef180ab448fdedde5da65f6ea249">DH_check_pubkey</a> (const DH *dh, const BIGNUM *pub_key, int *codes)</td></tr> 44226031Sstas 45226031Sstas<tr><td class="memItemLeft" nowrap align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="group__hcrypto__dh.html#gb90ec6b9e64f62c05754731c0c13ea01">DH_generate_key</a> (DH *dh)</td></tr> 46226031Sstas 47226031Sstas<tr><td class="memItemLeft" nowrap align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="group__hcrypto__dh.html#gf8b793df62108341ed3dc54a0ca75ca8">DH_compute_key</a> (unsigned char *shared_key, const BIGNUM *peer_pub_key, DH *dh)</td></tr> 48226031Sstas 49226031Sstas<tr><td class="memItemLeft" nowrap align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="group__hcrypto__dh.html#ge8f6c9ec1c2e4904439227a952980fdd">DH_set_method</a> (DH *dh, const DH_METHOD *method)</td></tr> 50226031Sstas 51226031Sstas<tr><td class="memItemLeft" nowrap align="right" valign="top">const DH_METHOD * </td><td class="memItemRight" valign="bottom"><a class="el" href="group__hcrypto__dh.html#g1e3dc0dbc1ba678716d28654c0eded84">DH_null_method</a> (void)</td></tr> 52226031Sstas 53226031Sstas<tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="group__hcrypto__dh.html#g6c63e1e8af5957d7f798439c854d06b6">DH_set_default_method</a> (const DH_METHOD *meth)</td></tr> 54226031Sstas 55226031Sstas<tr><td class="memItemLeft" nowrap align="right" valign="top">const DH_METHOD * </td><td class="memItemRight" valign="bottom"><a class="el" href="group__hcrypto__dh.html#ge2b07654d087940e36e7583887d8b070">DH_get_default_method</a> (void)</td></tr> 56226031Sstas 57226031Sstas</table> 58226031Sstas<hr><a name="_details"></a><h2>Detailed Description</h2> 59226031SstasSee the <a class="el" href="page_dh.html">DH - Diffie-Hellman key exchange</a> for description and examples. <hr><h2>Function Documentation</h2> 60226031Sstas<a class="anchor" name="g8995ef180ab448fdedde5da65f6ea249"></a><!-- doxytag: member="dh.c::DH_check_pubkey" ref="g8995ef180ab448fdedde5da65f6ea249" args="(const DH *dh, const BIGNUM *pub_key, int *codes)" --> 61226031Sstas<div class="memitem"> 62226031Sstas<div class="memproto"> 63226031Sstas <table class="memname"> 64226031Sstas <tr> 65226031Sstas <td class="memname">int DH_check_pubkey </td> 66226031Sstas <td>(</td> 67226031Sstas <td class="paramtype">const DH * </td> 68226031Sstas <td class="paramname"> <em>dh</em>, </td> 69226031Sstas </tr> 70226031Sstas <tr> 71226031Sstas <td class="paramkey"></td> 72226031Sstas <td></td> 73226031Sstas <td class="paramtype">const BIGNUM * </td> 74226031Sstas <td class="paramname"> <em>pub_key</em>, </td> 75226031Sstas </tr> 76226031Sstas <tr> 77226031Sstas <td class="paramkey"></td> 78226031Sstas <td></td> 79226031Sstas <td class="paramtype">int * </td> 80226031Sstas <td class="paramname"> <em>codes</em></td><td> </td> 81226031Sstas </tr> 82226031Sstas <tr> 83226031Sstas <td></td> 84226031Sstas <td>)</td> 85226031Sstas <td></td><td></td><td></td> 86226031Sstas </tr> 87226031Sstas </table> 88226031Sstas</div> 89226031Sstas<div class="memdoc"> 90226031Sstas 91226031Sstas<p> 92226031SstasCheck that the public key is sane.<p> 93226031Sstas<dl compact><dt><b>Parameters:</b></dt><dd> 94226031Sstas <table border="0" cellspacing="2" cellpadding="0"> 95226031Sstas <tr><td valign="top"></td><td valign="top"><em>dh</em> </td><td>the local peer DH parameters. </td></tr> 96226031Sstas <tr><td valign="top"></td><td valign="top"><em>pub_key</em> </td><td>the remote peer public key parameters. </td></tr> 97226031Sstas <tr><td valign="top"></td><td valign="top"><em>codes</em> </td><td>return that the failures of the pub_key are.</td></tr> 98226031Sstas </table> 99226031Sstas</dl> 100226031Sstas<dl class="return" compact><dt><b>Returns:</b></dt><dd>1 on success, 0 on failure and *codes is set the the combined fail check for the public key </dd></dl> 101226031Sstas 102226031Sstas<p> 103226031SstasChecks that the function performs are:<ul> 104226031Sstas<li>pub_key is not negative</li></ul> 105226031Sstas<p> 106226031Sstas<ul> 107226031Sstas<li>pub_key > 1 and pub_key < p - 1, to avoid small subgroups attack.</li></ul> 108226031Sstas<p> 109226031Sstas<ul> 110226031Sstas<li>if g == 2, pub_key have more then one bit set, if bits set is 1, log_2(pub_key) is trival </li></ul> 111226031Sstas 112226031Sstas</div> 113226031Sstas</div><p> 114226031Sstas<a class="anchor" name="gf8b793df62108341ed3dc54a0ca75ca8"></a><!-- doxytag: member="dh.c::DH_compute_key" ref="gf8b793df62108341ed3dc54a0ca75ca8" args="(unsigned char *shared_key, const BIGNUM *peer_pub_key, DH *dh)" --> 115226031Sstas<div class="memitem"> 116226031Sstas<div class="memproto"> 117226031Sstas <table class="memname"> 118226031Sstas <tr> 119226031Sstas <td class="memname">int DH_compute_key </td> 120226031Sstas <td>(</td> 121226031Sstas <td class="paramtype">unsigned char * </td> 122226031Sstas <td class="paramname"> <em>shared_key</em>, </td> 123226031Sstas </tr> 124226031Sstas <tr> 125226031Sstas <td class="paramkey"></td> 126226031Sstas <td></td> 127226031Sstas <td class="paramtype">const BIGNUM * </td> 128226031Sstas <td class="paramname"> <em>peer_pub_key</em>, </td> 129226031Sstas </tr> 130226031Sstas <tr> 131226031Sstas <td class="paramkey"></td> 132226031Sstas <td></td> 133226031Sstas <td class="paramtype">DH * </td> 134226031Sstas <td class="paramname"> <em>dh</em></td><td> </td> 135226031Sstas </tr> 136226031Sstas <tr> 137226031Sstas <td></td> 138226031Sstas <td>)</td> 139226031Sstas <td></td><td></td><td></td> 140226031Sstas </tr> 141226031Sstas </table> 142226031Sstas</div> 143226031Sstas<div class="memdoc"> 144226031Sstas 145226031Sstas<p> 146226031SstasComplute the shared secret key.<p> 147226031Sstas<dl compact><dt><b>Parameters:</b></dt><dd> 148226031Sstas <table border="0" cellspacing="2" cellpadding="0"> 149226031Sstas <tr><td valign="top"></td><td valign="top"><em>shared_key</em> </td><td>the resulting shared key, need to be at least <a class="el" href="group__hcrypto__dh.html#g9e1fdd62e3bfe4b671dbfc363f0e6297">DH_size()</a> large. </td></tr> 150226031Sstas <tr><td valign="top"></td><td valign="top"><em>peer_pub_key</em> </td><td>the peer's public key. </td></tr> 151226031Sstas <tr><td valign="top"></td><td valign="top"><em>dh</em> </td><td>the dh key pair.</td></tr> 152226031Sstas </table> 153226031Sstas</dl> 154226031Sstas<dl class="return" compact><dt><b>Returns:</b></dt><dd>1 on success. </dd></dl> 155226031Sstas 156226031Sstas<p> 157226031SstasChecks that the pubkey passed in is valid using <a class="el" href="group__hcrypto__dh.html#g8995ef180ab448fdedde5da65f6ea249">DH_check_pubkey()</a>. 158226031Sstas</div> 159226031Sstas</div><p> 160226031Sstas<a class="anchor" name="g1f15312ca21e290ee714e86578820c35"></a><!-- doxytag: member="dh.c::DH_free" ref="g1f15312ca21e290ee714e86578820c35" args="(DH *dh)" --> 161226031Sstas<div class="memitem"> 162226031Sstas<div class="memproto"> 163226031Sstas <table class="memname"> 164226031Sstas <tr> 165226031Sstas <td class="memname">void DH_free </td> 166226031Sstas <td>(</td> 167226031Sstas <td class="paramtype">DH * </td> 168226031Sstas <td class="paramname"> <em>dh</em> </td> 169226031Sstas <td> ) </td> 170226031Sstas <td></td> 171226031Sstas </tr> 172226031Sstas </table> 173226031Sstas</div> 174226031Sstas<div class="memdoc"> 175226031Sstas 176226031Sstas<p> 177226031SstasFree a DH object and release related resources, like ENGINE, that the object was using.<p> 178226031Sstas<dl compact><dt><b>Parameters:</b></dt><dd> 179226031Sstas <table border="0" cellspacing="2" cellpadding="0"> 180226031Sstas <tr><td valign="top"></td><td valign="top"><em>dh</em> </td><td>object to be freed. </td></tr> 181226031Sstas </table> 182226031Sstas</dl> 183226031Sstas 184226031Sstas</div> 185226031Sstas</div><p> 186226031Sstas<a class="anchor" name="gb90ec6b9e64f62c05754731c0c13ea01"></a><!-- doxytag: member="dh.c::DH_generate_key" ref="gb90ec6b9e64f62c05754731c0c13ea01" args="(DH *dh)" --> 187226031Sstas<div class="memitem"> 188226031Sstas<div class="memproto"> 189226031Sstas <table class="memname"> 190226031Sstas <tr> 191226031Sstas <td class="memname">int DH_generate_key </td> 192226031Sstas <td>(</td> 193226031Sstas <td class="paramtype">DH * </td> 194226031Sstas <td class="paramname"> <em>dh</em> </td> 195226031Sstas <td> ) </td> 196226031Sstas <td></td> 197226031Sstas </tr> 198226031Sstas </table> 199226031Sstas</div> 200226031Sstas<div class="memdoc"> 201226031Sstas 202226031Sstas<p> 203226031SstasGenerate a new DH private-public key pair. The dh parameter must be allocted first with <a class="el" href="group__hcrypto__dh.html#g76c6e12bd1f0b9977d80fee83b086031">DH_new()</a>. dh->p and dp->g must be set.<p> 204226031Sstas<dl compact><dt><b>Parameters:</b></dt><dd> 205226031Sstas <table border="0" cellspacing="2" cellpadding="0"> 206226031Sstas <tr><td valign="top"></td><td valign="top"><em>dh</em> </td><td>dh parameter.</td></tr> 207226031Sstas </table> 208226031Sstas</dl> 209226031Sstas<dl class="return" compact><dt><b>Returns:</b></dt><dd>1 on success. </dd></dl> 210226031Sstas 211226031Sstas</div> 212226031Sstas</div><p> 213226031Sstas<a class="anchor" name="g11ef051e93bc408f3e7ba77d44c5d3cb"></a><!-- doxytag: member="dh.c::DH_generate_parameters_ex" ref="g11ef051e93bc408f3e7ba77d44c5d3cb" args="(DH *dh, int prime_len, int generator, BN_GENCB *cb)" --> 214226031Sstas<div class="memitem"> 215226031Sstas<div class="memproto"> 216226031Sstas <table class="memname"> 217226031Sstas <tr> 218226031Sstas <td class="memname">int DH_generate_parameters_ex </td> 219226031Sstas <td>(</td> 220226031Sstas <td class="paramtype">DH * </td> 221226031Sstas <td class="paramname"> <em>dh</em>, </td> 222226031Sstas </tr> 223226031Sstas <tr> 224226031Sstas <td class="paramkey"></td> 225226031Sstas <td></td> 226226031Sstas <td class="paramtype">int </td> 227226031Sstas <td class="paramname"> <em>prime_len</em>, </td> 228226031Sstas </tr> 229226031Sstas <tr> 230226031Sstas <td class="paramkey"></td> 231226031Sstas <td></td> 232226031Sstas <td class="paramtype">int </td> 233226031Sstas <td class="paramname"> <em>generator</em>, </td> 234226031Sstas </tr> 235226031Sstas <tr> 236226031Sstas <td class="paramkey"></td> 237226031Sstas <td></td> 238226031Sstas <td class="paramtype">BN_GENCB * </td> 239226031Sstas <td class="paramname"> <em>cb</em></td><td> </td> 240226031Sstas </tr> 241226031Sstas <tr> 242226031Sstas <td></td> 243226031Sstas <td>)</td> 244226031Sstas <td></td><td></td><td></td> 245226031Sstas </tr> 246226031Sstas </table> 247226031Sstas</div> 248226031Sstas<div class="memdoc"> 249226031Sstas 250226031Sstas<p> 251226031SstasGenerate DH parameters for the DH object give parameters.<p> 252226031Sstas<dl compact><dt><b>Parameters:</b></dt><dd> 253226031Sstas <table border="0" cellspacing="2" cellpadding="0"> 254226031Sstas <tr><td valign="top"></td><td valign="top"><em>dh</em> </td><td>The DH object to generate parameters for. </td></tr> 255226031Sstas <tr><td valign="top"></td><td valign="top"><em>prime_len</em> </td><td>length of the prime </td></tr> 256226031Sstas <tr><td valign="top"></td><td valign="top"><em>generator</em> </td><td>generator, g </td></tr> 257226031Sstas <tr><td valign="top"></td><td valign="top"><em>cb</em> </td><td>Callback parameters to show progress, can be NULL.</td></tr> 258226031Sstas </table> 259226031Sstas</dl> 260226031Sstas<dl class="return" compact><dt><b>Returns:</b></dt><dd>the maximum size in bytes of the out data. </dd></dl> 261226031Sstas 262226031Sstas</div> 263226031Sstas</div><p> 264226031Sstas<a class="anchor" name="ge2b07654d087940e36e7583887d8b070"></a><!-- doxytag: member="dh.c::DH_get_default_method" ref="ge2b07654d087940e36e7583887d8b070" args="(void)" --> 265226031Sstas<div class="memitem"> 266226031Sstas<div class="memproto"> 267226031Sstas <table class="memname"> 268226031Sstas <tr> 269226031Sstas <td class="memname">const DH_METHOD* DH_get_default_method </td> 270226031Sstas <td>(</td> 271226031Sstas <td class="paramtype">void </td> 272226031Sstas <td class="paramname"> </td> 273226031Sstas <td> ) </td> 274226031Sstas <td></td> 275226031Sstas </tr> 276226031Sstas </table> 277226031Sstas</div> 278226031Sstas<div class="memdoc"> 279226031Sstas 280226031Sstas<p> 281226031SstasReturn the default DH implementation.<p> 282226031Sstas<dl class="return" compact><dt><b>Returns:</b></dt><dd>pointer to a DH_METHOD. </dd></dl> 283226031Sstas 284226031Sstas</div> 285226031Sstas</div><p> 286226031Sstas<a class="anchor" name="g25fff6e977829c49410f046b8cc3471d"></a><!-- doxytag: member="dh.c::DH_get_ex_data" ref="g25fff6e977829c49410f046b8cc3471d" args="(DH *dh, int idx)" --> 287226031Sstas<div class="memitem"> 288226031Sstas<div class="memproto"> 289226031Sstas <table class="memname"> 290226031Sstas <tr> 291226031Sstas <td class="memname">void* DH_get_ex_data </td> 292226031Sstas <td>(</td> 293226031Sstas <td class="paramtype">DH * </td> 294226031Sstas <td class="paramname"> <em>dh</em>, </td> 295226031Sstas </tr> 296226031Sstas <tr> 297226031Sstas <td class="paramkey"></td> 298226031Sstas <td></td> 299226031Sstas <td class="paramtype">int </td> 300226031Sstas <td class="paramname"> <em>idx</em></td><td> </td> 301226031Sstas </tr> 302226031Sstas <tr> 303226031Sstas <td></td> 304226031Sstas <td>)</td> 305226031Sstas <td></td><td></td><td></td> 306226031Sstas </tr> 307226031Sstas </table> 308226031Sstas</div> 309226031Sstas<div class="memdoc"> 310226031Sstas 311226031Sstas<p> 312226031SstasGet the data for index idx in the DH object.<p> 313226031Sstas<dl compact><dt><b>Parameters:</b></dt><dd> 314226031Sstas <table border="0" cellspacing="2" cellpadding="0"> 315226031Sstas <tr><td valign="top"></td><td valign="top"><em>dh</em> </td><td>DH object. </td></tr> 316226031Sstas <tr><td valign="top"></td><td valign="top"><em>idx</em> </td><td>index to get the data for.</td></tr> 317226031Sstas </table> 318226031Sstas</dl> 319226031Sstas<dl class="return" compact><dt><b>Returns:</b></dt><dd>the object store in index idx </dd></dl> 320226031Sstas 321226031Sstas</div> 322226031Sstas</div><p> 323226031Sstas<a class="anchor" name="gbfe13af1fef654a94a9be268df6d8809"></a><!-- doxytag: member="dh-ltm.c::DH_ltm_method" ref="gbfe13af1fef654a94a9be268df6d8809" args="(void)" --> 324226031Sstas<div class="memitem"> 325226031Sstas<div class="memproto"> 326226031Sstas <table class="memname"> 327226031Sstas <tr> 328226031Sstas <td class="memname">const DH_METHOD* DH_ltm_method </td> 329226031Sstas <td>(</td> 330226031Sstas <td class="paramtype">void </td> 331226031Sstas <td class="paramname"> </td> 332226031Sstas <td> ) </td> 333226031Sstas <td></td> 334226031Sstas </tr> 335226031Sstas </table> 336226031Sstas</div> 337226031Sstas<div class="memdoc"> 338226031Sstas 339226031Sstas<p> 340226031SstasDH implementation using libtommath.<p> 341226031Sstas<dl class="return" compact><dt><b>Returns:</b></dt><dd>the DH_METHOD for the DH implementation using libtommath. </dd></dl> 342226031Sstas 343226031Sstas</div> 344226031Sstas</div><p> 345226031Sstas<a class="anchor" name="g76c6e12bd1f0b9977d80fee83b086031"></a><!-- doxytag: member="dh.c::DH_new" ref="g76c6e12bd1f0b9977d80fee83b086031" args="(void)" --> 346226031Sstas<div class="memitem"> 347226031Sstas<div class="memproto"> 348226031Sstas <table class="memname"> 349226031Sstas <tr> 350226031Sstas <td class="memname">DH* DH_new </td> 351226031Sstas <td>(</td> 352226031Sstas <td class="paramtype">void </td> 353226031Sstas <td class="paramname"> </td> 354226031Sstas <td> ) </td> 355226031Sstas <td></td> 356226031Sstas </tr> 357226031Sstas </table> 358226031Sstas</div> 359226031Sstas<div class="memdoc"> 360226031Sstas 361226031Sstas<p> 362226031SstasCreate a new DH object using DH_new_method(NULL), see <a class="el" href="group__hcrypto__dh.html#g2e97e03aee56c6094bb7fd6322b3ce68">DH_new_method()</a>.<p> 363226031Sstas<dl class="return" compact><dt><b>Returns:</b></dt><dd>a newly allocated DH object. </dd></dl> 364226031Sstas 365226031Sstas</div> 366226031Sstas</div><p> 367226031Sstas<a class="anchor" name="g2e97e03aee56c6094bb7fd6322b3ce68"></a><!-- doxytag: member="dh.c::DH_new_method" ref="g2e97e03aee56c6094bb7fd6322b3ce68" args="(ENGINE *engine)" --> 368226031Sstas<div class="memitem"> 369226031Sstas<div class="memproto"> 370226031Sstas <table class="memname"> 371226031Sstas <tr> 372226031Sstas <td class="memname">DH* DH_new_method </td> 373226031Sstas <td>(</td> 374226031Sstas <td class="paramtype">ENGINE * </td> 375226031Sstas <td class="paramname"> <em>engine</em> </td> 376226031Sstas <td> ) </td> 377226031Sstas <td></td> 378226031Sstas </tr> 379226031Sstas </table> 380226031Sstas</div> 381226031Sstas<div class="memdoc"> 382226031Sstas 383226031Sstas<p> 384226031SstasCreate a new DH object from the given engine, if the NULL is used, the default engine is used. Free the DH object with <a class="el" href="group__hcrypto__dh.html#g1f15312ca21e290ee714e86578820c35">DH_free()</a>.<p> 385226031Sstas<dl compact><dt><b>Parameters:</b></dt><dd> 386226031Sstas <table border="0" cellspacing="2" cellpadding="0"> 387226031Sstas <tr><td valign="top"></td><td valign="top"><em>engine</em> </td><td>The engine to use to allocate the DH object.</td></tr> 388226031Sstas </table> 389226031Sstas</dl> 390226031Sstas<dl class="return" compact><dt><b>Returns:</b></dt><dd>a newly allocated DH object. </dd></dl> 391226031Sstas 392226031Sstas</div> 393226031Sstas</div><p> 394226031Sstas<a class="anchor" name="g1e3dc0dbc1ba678716d28654c0eded84"></a><!-- doxytag: member="dh.c::DH_null_method" ref="g1e3dc0dbc1ba678716d28654c0eded84" args="(void)" --> 395226031Sstas<div class="memitem"> 396226031Sstas<div class="memproto"> 397226031Sstas <table class="memname"> 398226031Sstas <tr> 399226031Sstas <td class="memname">const DH_METHOD* DH_null_method </td> 400226031Sstas <td>(</td> 401226031Sstas <td class="paramtype">void </td> 402226031Sstas <td class="paramname"> </td> 403226031Sstas <td> ) </td> 404226031Sstas <td></td> 405226031Sstas </tr> 406226031Sstas </table> 407226031Sstas</div> 408226031Sstas<div class="memdoc"> 409226031Sstas 410226031Sstas<p> 411226031SstasReturn the dummy DH implementation.<p> 412226031Sstas<dl class="return" compact><dt><b>Returns:</b></dt><dd>pointer to a DH_METHOD. </dd></dl> 413226031Sstas 414226031Sstas</div> 415226031Sstas</div><p> 416226031Sstas<a class="anchor" name="g6c63e1e8af5957d7f798439c854d06b6"></a><!-- doxytag: member="dh.c::DH_set_default_method" ref="g6c63e1e8af5957d7f798439c854d06b6" args="(const DH_METHOD *meth)" --> 417226031Sstas<div class="memitem"> 418226031Sstas<div class="memproto"> 419226031Sstas <table class="memname"> 420226031Sstas <tr> 421226031Sstas <td class="memname">void DH_set_default_method </td> 422226031Sstas <td>(</td> 423226031Sstas <td class="paramtype">const DH_METHOD * </td> 424226031Sstas <td class="paramname"> <em>meth</em> </td> 425226031Sstas <td> ) </td> 426226031Sstas <td></td> 427226031Sstas </tr> 428226031Sstas </table> 429226031Sstas</div> 430226031Sstas<div class="memdoc"> 431226031Sstas 432226031Sstas<p> 433226031SstasSet the default DH implementation.<p> 434226031Sstas<dl compact><dt><b>Parameters:</b></dt><dd> 435226031Sstas <table border="0" cellspacing="2" cellpadding="0"> 436226031Sstas <tr><td valign="top"></td><td valign="top"><em>meth</em> </td><td>pointer to a DH_METHOD. </td></tr> 437226031Sstas </table> 438226031Sstas</dl> 439226031Sstas 440226031Sstas</div> 441226031Sstas</div><p> 442226031Sstas<a class="anchor" name="g7a03e7589a8473ed34cf2a4177709c0e"></a><!-- doxytag: member="dh.c::DH_set_ex_data" ref="g7a03e7589a8473ed34cf2a4177709c0e" args="(DH *dh, int idx, void *data)" --> 443226031Sstas<div class="memitem"> 444226031Sstas<div class="memproto"> 445226031Sstas <table class="memname"> 446226031Sstas <tr> 447226031Sstas <td class="memname">int DH_set_ex_data </td> 448226031Sstas <td>(</td> 449226031Sstas <td class="paramtype">DH * </td> 450226031Sstas <td class="paramname"> <em>dh</em>, </td> 451226031Sstas </tr> 452226031Sstas <tr> 453226031Sstas <td class="paramkey"></td> 454226031Sstas <td></td> 455226031Sstas <td class="paramtype">int </td> 456226031Sstas <td class="paramname"> <em>idx</em>, </td> 457226031Sstas </tr> 458226031Sstas <tr> 459226031Sstas <td class="paramkey"></td> 460226031Sstas <td></td> 461226031Sstas <td class="paramtype">void * </td> 462226031Sstas <td class="paramname"> <em>data</em></td><td> </td> 463226031Sstas </tr> 464226031Sstas <tr> 465226031Sstas <td></td> 466226031Sstas <td>)</td> 467226031Sstas <td></td><td></td><td></td> 468226031Sstas </tr> 469226031Sstas </table> 470226031Sstas</div> 471226031Sstas<div class="memdoc"> 472226031Sstas 473226031Sstas<p> 474226031SstasSet the data index idx in the DH object to data.<p> 475226031Sstas<dl compact><dt><b>Parameters:</b></dt><dd> 476226031Sstas <table border="0" cellspacing="2" cellpadding="0"> 477226031Sstas <tr><td valign="top"></td><td valign="top"><em>dh</em> </td><td>DH object. </td></tr> 478226031Sstas <tr><td valign="top"></td><td valign="top"><em>idx</em> </td><td>index to set the data for. </td></tr> 479226031Sstas <tr><td valign="top"></td><td valign="top"><em>data</em> </td><td>data to store for the index idx.</td></tr> 480226031Sstas </table> 481226031Sstas</dl> 482226031Sstas<dl class="return" compact><dt><b>Returns:</b></dt><dd>1 on success. </dd></dl> 483226031Sstas 484226031Sstas</div> 485226031Sstas</div><p> 486226031Sstas<a class="anchor" name="ge8f6c9ec1c2e4904439227a952980fdd"></a><!-- doxytag: member="dh.c::DH_set_method" ref="ge8f6c9ec1c2e4904439227a952980fdd" args="(DH *dh, const DH_METHOD *method)" --> 487226031Sstas<div class="memitem"> 488226031Sstas<div class="memproto"> 489226031Sstas <table class="memname"> 490226031Sstas <tr> 491226031Sstas <td class="memname">int DH_set_method </td> 492226031Sstas <td>(</td> 493226031Sstas <td class="paramtype">DH * </td> 494226031Sstas <td class="paramname"> <em>dh</em>, </td> 495226031Sstas </tr> 496226031Sstas <tr> 497226031Sstas <td class="paramkey"></td> 498226031Sstas <td></td> 499226031Sstas <td class="paramtype">const DH_METHOD * </td> 500226031Sstas <td class="paramname"> <em>method</em></td><td> </td> 501226031Sstas </tr> 502226031Sstas <tr> 503226031Sstas <td></td> 504226031Sstas <td>)</td> 505226031Sstas <td></td><td></td><td></td> 506226031Sstas </tr> 507226031Sstas </table> 508226031Sstas</div> 509226031Sstas<div class="memdoc"> 510226031Sstas 511226031Sstas<p> 512226031SstasSet a new method for the DH keypair.<p> 513226031Sstas<dl compact><dt><b>Parameters:</b></dt><dd> 514226031Sstas <table border="0" cellspacing="2" cellpadding="0"> 515226031Sstas <tr><td valign="top"></td><td valign="top"><em>dh</em> </td><td>dh parameter. </td></tr> 516226031Sstas <tr><td valign="top"></td><td valign="top"><em>method</em> </td><td>the new method for the DH parameter.</td></tr> 517226031Sstas </table> 518226031Sstas</dl> 519226031Sstas<dl class="return" compact><dt><b>Returns:</b></dt><dd>1 on success. </dd></dl> 520226031Sstas 521226031Sstas</div> 522226031Sstas</div><p> 523226031Sstas<a class="anchor" name="g9e1fdd62e3bfe4b671dbfc363f0e6297"></a><!-- doxytag: member="dh.c::DH_size" ref="g9e1fdd62e3bfe4b671dbfc363f0e6297" args="(const DH *dh)" --> 524226031Sstas<div class="memitem"> 525226031Sstas<div class="memproto"> 526226031Sstas <table class="memname"> 527226031Sstas <tr> 528226031Sstas <td class="memname">int DH_size </td> 529226031Sstas <td>(</td> 530226031Sstas <td class="paramtype">const DH * </td> 531226031Sstas <td class="paramname"> <em>dh</em> </td> 532226031Sstas <td> ) </td> 533226031Sstas <td></td> 534226031Sstas </tr> 535226031Sstas </table> 536226031Sstas</div> 537226031Sstas<div class="memdoc"> 538226031Sstas 539226031Sstas<p> 540226031SstasThe maximum output size of the <a class="el" href="group__hcrypto__dh.html#gf8b793df62108341ed3dc54a0ca75ca8">DH_compute_key()</a> function.<p> 541226031Sstas<dl compact><dt><b>Parameters:</b></dt><dd> 542226031Sstas <table border="0" cellspacing="2" cellpadding="0"> 543226031Sstas <tr><td valign="top"></td><td valign="top"><em>dh</em> </td><td>The DH object to get the size from.</td></tr> 544226031Sstas </table> 545226031Sstas</dl> 546226031Sstas<dl class="return" compact><dt><b>Returns:</b></dt><dd>the maximum size in bytes of the out data. </dd></dl> 547226031Sstas 548226031Sstas</div> 549226031Sstas</div><p> 550226031Sstas<a class="anchor" name="gf7c3e51cba326865c3684012c2337df1"></a><!-- doxytag: member="dh.c::DH_up_ref" ref="gf7c3e51cba326865c3684012c2337df1" args="(DH *dh)" --> 551226031Sstas<div class="memitem"> 552226031Sstas<div class="memproto"> 553226031Sstas <table class="memname"> 554226031Sstas <tr> 555226031Sstas <td class="memname">int DH_up_ref </td> 556226031Sstas <td>(</td> 557226031Sstas <td class="paramtype">DH * </td> 558226031Sstas <td class="paramname"> <em>dh</em> </td> 559226031Sstas <td> ) </td> 560226031Sstas <td></td> 561226031Sstas </tr> 562226031Sstas </table> 563226031Sstas</div> 564226031Sstas<div class="memdoc"> 565226031Sstas 566226031Sstas<p> 567226031SstasAdd a reference to the DH object. The object should be free with <a class="el" href="group__hcrypto__dh.html#g1f15312ca21e290ee714e86578820c35">DH_free()</a> to drop the reference.<p> 568226031Sstas<dl compact><dt><b>Parameters:</b></dt><dd> 569226031Sstas <table border="0" cellspacing="2" cellpadding="0"> 570226031Sstas <tr><td valign="top"></td><td valign="top"><em>dh</em> </td><td>the object to increase the reference count too.</td></tr> 571226031Sstas </table> 572226031Sstas</dl> 573226031Sstas<dl class="return" compact><dt><b>Returns:</b></dt><dd>the updated reference count, can't safely be used except for debug printing. </dd></dl> 574226031Sstas 575226031Sstas</div> 576226031Sstas</div><p> 577226031Sstas</div> 578226031Sstas<hr size="1"><address style="text-align: right;"><small> 579226031SstasGenerated on Sat Jul 30 13:45:37 2011 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> 580226031Sstas</body> 581226031Sstas</html> 582