xref: /freebsd/crypto/heimdal/doc/doxyout/hcrypto/html/group__hcrypto__dh.html (revision 7ef62cebc2f965b0f640263e179276928885e33d)
1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2<html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
3<title>Heimdal crypto library: Diffie-Hellman functions</title>
4<link href="doxygen.css" rel="stylesheet" type="text/css">
5<link href="tabs.css" rel="stylesheet" type="text/css">
6</head><body>
7<p>
8<a href="http://www.h5l.org/"><img src="http://www.h5l.org/keyhole-heimdal.png" alt="keyhole logo"/></a>
9</p>
10<!-- end of header marker -->
11<!-- Generated by Doxygen 1.5.6 -->
12<div class="navigation" id="top">
13  <div class="tabs">
14    <ul>
15      <li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
16      <li><a href="modules.html"><span>Modules</span></a></li>
17      <li><a href="examples.html"><span>Examples</span></a></li>
18    </ul>
19  </div>
20</div>
21<div class="contents">
22<h1>Diffie-Hellman functions</h1><table border="0" cellpadding="0" cellspacing="0">
23<tr><td></td></tr>
24<tr><td colspan="2"><br><h2>Functions</h2></td></tr>
25<tr><td class="memItemLeft" nowrap align="right" valign="top">const DH_METHOD *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__hcrypto__dh.html#gbfe13af1fef654a94a9be268df6d8809">DH_ltm_method</a> (void)</td></tr>
26
27<tr><td class="memItemLeft" nowrap align="right" valign="top">DH *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__hcrypto__dh.html#g76c6e12bd1f0b9977d80fee83b086031">DH_new</a> (void)</td></tr>
28
29<tr><td class="memItemLeft" nowrap align="right" valign="top">DH *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__hcrypto__dh.html#g2e97e03aee56c6094bb7fd6322b3ce68">DH_new_method</a> (ENGINE *engine)</td></tr>
30
31<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__hcrypto__dh.html#g1f15312ca21e290ee714e86578820c35">DH_free</a> (DH *dh)</td></tr>
32
33<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__hcrypto__dh.html#gf7c3e51cba326865c3684012c2337df1">DH_up_ref</a> (DH *dh)</td></tr>
34
35<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__hcrypto__dh.html#g9e1fdd62e3bfe4b671dbfc363f0e6297">DH_size</a> (const DH *dh)</td></tr>
36
37<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__hcrypto__dh.html#g7a03e7589a8473ed34cf2a4177709c0e">DH_set_ex_data</a> (DH *dh, int idx, void *data)</td></tr>
38
39<tr><td class="memItemLeft" nowrap align="right" valign="top">void *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__hcrypto__dh.html#g25fff6e977829c49410f046b8cc3471d">DH_get_ex_data</a> (DH *dh, int idx)</td></tr>
40
41<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__hcrypto__dh.html#g11ef051e93bc408f3e7ba77d44c5d3cb">DH_generate_parameters_ex</a> (DH *dh, int prime_len, int generator, BN_GENCB *cb)</td></tr>
42
43<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__hcrypto__dh.html#g8995ef180ab448fdedde5da65f6ea249">DH_check_pubkey</a> (const DH *dh, const BIGNUM *pub_key, int *codes)</td></tr>
44
45<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__hcrypto__dh.html#gb90ec6b9e64f62c05754731c0c13ea01">DH_generate_key</a> (DH *dh)</td></tr>
46
47<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</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>
48
49<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</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>
50
51<tr><td class="memItemLeft" nowrap align="right" valign="top">const DH_METHOD *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__hcrypto__dh.html#g1e3dc0dbc1ba678716d28654c0eded84">DH_null_method</a> (void)</td></tr>
52
53<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</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>
54
55<tr><td class="memItemLeft" nowrap align="right" valign="top">const DH_METHOD *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__hcrypto__dh.html#ge2b07654d087940e36e7583887d8b070">DH_get_default_method</a> (void)</td></tr>
56
57</table>
58<hr><a name="_details"></a><h2>Detailed Description</h2>
59See the <a class="el" href="page_dh.html">DH - Diffie-Hellman key exchange</a> for description and examples. <hr><h2>Function Documentation</h2>
60<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)" -->
61<div class="memitem">
62<div class="memproto">
63      <table class="memname">
64        <tr>
65          <td class="memname">int DH_check_pubkey           </td>
66          <td>(</td>
67          <td class="paramtype">const DH *&nbsp;</td>
68          <td class="paramname"> <em>dh</em>, </td>
69        </tr>
70        <tr>
71          <td class="paramkey"></td>
72          <td></td>
73          <td class="paramtype">const BIGNUM *&nbsp;</td>
74          <td class="paramname"> <em>pub_key</em>, </td>
75        </tr>
76        <tr>
77          <td class="paramkey"></td>
78          <td></td>
79          <td class="paramtype">int *&nbsp;</td>
80          <td class="paramname"> <em>codes</em></td><td>&nbsp;</td>
81        </tr>
82        <tr>
83          <td></td>
84          <td>)</td>
85          <td></td><td></td><td></td>
86        </tr>
87      </table>
88</div>
89<div class="memdoc">
90
91<p>
92Check that the public key is sane.<p>
93<dl compact><dt><b>Parameters:</b></dt><dd>
94  <table border="0" cellspacing="2" cellpadding="0">
95    <tr><td valign="top"></td><td valign="top"><em>dh</em>&nbsp;</td><td>the local peer DH parameters. </td></tr>
96    <tr><td valign="top"></td><td valign="top"><em>pub_key</em>&nbsp;</td><td>the remote peer public key parameters. </td></tr>
97    <tr><td valign="top"></td><td valign="top"><em>codes</em>&nbsp;</td><td>return that the failures of the pub_key are.</td></tr>
98  </table>
99</dl>
100<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>
101
102<p>
103Checks that the function performs are:<ul>
104<li>pub_key is not negative</li></ul>
105<p>
106<ul>
107<li>pub_key &gt; 1 and pub_key &lt; p - 1, to avoid small subgroups attack.</li></ul>
108<p>
109<ul>
110<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>
111
112</div>
113</div><p>
114<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)" -->
115<div class="memitem">
116<div class="memproto">
117      <table class="memname">
118        <tr>
119          <td class="memname">int DH_compute_key           </td>
120          <td>(</td>
121          <td class="paramtype">unsigned char *&nbsp;</td>
122          <td class="paramname"> <em>shared_key</em>, </td>
123        </tr>
124        <tr>
125          <td class="paramkey"></td>
126          <td></td>
127          <td class="paramtype">const BIGNUM *&nbsp;</td>
128          <td class="paramname"> <em>peer_pub_key</em>, </td>
129        </tr>
130        <tr>
131          <td class="paramkey"></td>
132          <td></td>
133          <td class="paramtype">DH *&nbsp;</td>
134          <td class="paramname"> <em>dh</em></td><td>&nbsp;</td>
135        </tr>
136        <tr>
137          <td></td>
138          <td>)</td>
139          <td></td><td></td><td></td>
140        </tr>
141      </table>
142</div>
143<div class="memdoc">
144
145<p>
146Complute the shared secret key.<p>
147<dl compact><dt><b>Parameters:</b></dt><dd>
148  <table border="0" cellspacing="2" cellpadding="0">
149    <tr><td valign="top"></td><td valign="top"><em>shared_key</em>&nbsp;</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>
150    <tr><td valign="top"></td><td valign="top"><em>peer_pub_key</em>&nbsp;</td><td>the peer's public key. </td></tr>
151    <tr><td valign="top"></td><td valign="top"><em>dh</em>&nbsp;</td><td>the dh key pair.</td></tr>
152  </table>
153</dl>
154<dl class="return" compact><dt><b>Returns:</b></dt><dd>1 on success. </dd></dl>
155
156<p>
157Checks that the pubkey passed in is valid using <a class="el" href="group__hcrypto__dh.html#g8995ef180ab448fdedde5da65f6ea249">DH_check_pubkey()</a>.
158</div>
159</div><p>
160<a class="anchor" name="g1f15312ca21e290ee714e86578820c35"></a><!-- doxytag: member="dh.c::DH_free" ref="g1f15312ca21e290ee714e86578820c35" args="(DH *dh)" -->
161<div class="memitem">
162<div class="memproto">
163      <table class="memname">
164        <tr>
165          <td class="memname">void DH_free           </td>
166          <td>(</td>
167          <td class="paramtype">DH *&nbsp;</td>
168          <td class="paramname"> <em>dh</em>          </td>
169          <td>&nbsp;)&nbsp;</td>
170          <td></td>
171        </tr>
172      </table>
173</div>
174<div class="memdoc">
175
176<p>
177Free a DH object and release related resources, like ENGINE, that the object was using.<p>
178<dl compact><dt><b>Parameters:</b></dt><dd>
179  <table border="0" cellspacing="2" cellpadding="0">
180    <tr><td valign="top"></td><td valign="top"><em>dh</em>&nbsp;</td><td>object to be freed. </td></tr>
181  </table>
182</dl>
183
184</div>
185</div><p>
186<a class="anchor" name="gb90ec6b9e64f62c05754731c0c13ea01"></a><!-- doxytag: member="dh.c::DH_generate_key" ref="gb90ec6b9e64f62c05754731c0c13ea01" args="(DH *dh)" -->
187<div class="memitem">
188<div class="memproto">
189      <table class="memname">
190        <tr>
191          <td class="memname">int DH_generate_key           </td>
192          <td>(</td>
193          <td class="paramtype">DH *&nbsp;</td>
194          <td class="paramname"> <em>dh</em>          </td>
195          <td>&nbsp;)&nbsp;</td>
196          <td></td>
197        </tr>
198      </table>
199</div>
200<div class="memdoc">
201
202<p>
203Generate 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-&gt;p and dp-&gt;g must be set.<p>
204<dl compact><dt><b>Parameters:</b></dt><dd>
205  <table border="0" cellspacing="2" cellpadding="0">
206    <tr><td valign="top"></td><td valign="top"><em>dh</em>&nbsp;</td><td>dh parameter.</td></tr>
207  </table>
208</dl>
209<dl class="return" compact><dt><b>Returns:</b></dt><dd>1 on success. </dd></dl>
210
211</div>
212</div><p>
213<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)" -->
214<div class="memitem">
215<div class="memproto">
216      <table class="memname">
217        <tr>
218          <td class="memname">int DH_generate_parameters_ex           </td>
219          <td>(</td>
220          <td class="paramtype">DH *&nbsp;</td>
221          <td class="paramname"> <em>dh</em>, </td>
222        </tr>
223        <tr>
224          <td class="paramkey"></td>
225          <td></td>
226          <td class="paramtype">int&nbsp;</td>
227          <td class="paramname"> <em>prime_len</em>, </td>
228        </tr>
229        <tr>
230          <td class="paramkey"></td>
231          <td></td>
232          <td class="paramtype">int&nbsp;</td>
233          <td class="paramname"> <em>generator</em>, </td>
234        </tr>
235        <tr>
236          <td class="paramkey"></td>
237          <td></td>
238          <td class="paramtype">BN_GENCB *&nbsp;</td>
239          <td class="paramname"> <em>cb</em></td><td>&nbsp;</td>
240        </tr>
241        <tr>
242          <td></td>
243          <td>)</td>
244          <td></td><td></td><td></td>
245        </tr>
246      </table>
247</div>
248<div class="memdoc">
249
250<p>
251Generate DH parameters for the DH object give parameters.<p>
252<dl compact><dt><b>Parameters:</b></dt><dd>
253  <table border="0" cellspacing="2" cellpadding="0">
254    <tr><td valign="top"></td><td valign="top"><em>dh</em>&nbsp;</td><td>The DH object to generate parameters for. </td></tr>
255    <tr><td valign="top"></td><td valign="top"><em>prime_len</em>&nbsp;</td><td>length of the prime </td></tr>
256    <tr><td valign="top"></td><td valign="top"><em>generator</em>&nbsp;</td><td>generator, g </td></tr>
257    <tr><td valign="top"></td><td valign="top"><em>cb</em>&nbsp;</td><td>Callback parameters to show progress, can be NULL.</td></tr>
258  </table>
259</dl>
260<dl class="return" compact><dt><b>Returns:</b></dt><dd>the maximum size in bytes of the out data. </dd></dl>
261
262</div>
263</div><p>
264<a class="anchor" name="ge2b07654d087940e36e7583887d8b070"></a><!-- doxytag: member="dh.c::DH_get_default_method" ref="ge2b07654d087940e36e7583887d8b070" args="(void)" -->
265<div class="memitem">
266<div class="memproto">
267      <table class="memname">
268        <tr>
269          <td class="memname">const DH_METHOD* DH_get_default_method           </td>
270          <td>(</td>
271          <td class="paramtype">void&nbsp;</td>
272          <td class="paramname">          </td>
273          <td>&nbsp;)&nbsp;</td>
274          <td></td>
275        </tr>
276      </table>
277</div>
278<div class="memdoc">
279
280<p>
281Return the default DH implementation.<p>
282<dl class="return" compact><dt><b>Returns:</b></dt><dd>pointer to a DH_METHOD. </dd></dl>
283
284</div>
285</div><p>
286<a class="anchor" name="g25fff6e977829c49410f046b8cc3471d"></a><!-- doxytag: member="dh.c::DH_get_ex_data" ref="g25fff6e977829c49410f046b8cc3471d" args="(DH *dh, int idx)" -->
287<div class="memitem">
288<div class="memproto">
289      <table class="memname">
290        <tr>
291          <td class="memname">void* DH_get_ex_data           </td>
292          <td>(</td>
293          <td class="paramtype">DH *&nbsp;</td>
294          <td class="paramname"> <em>dh</em>, </td>
295        </tr>
296        <tr>
297          <td class="paramkey"></td>
298          <td></td>
299          <td class="paramtype">int&nbsp;</td>
300          <td class="paramname"> <em>idx</em></td><td>&nbsp;</td>
301        </tr>
302        <tr>
303          <td></td>
304          <td>)</td>
305          <td></td><td></td><td></td>
306        </tr>
307      </table>
308</div>
309<div class="memdoc">
310
311<p>
312Get the data for index idx in the DH object.<p>
313<dl compact><dt><b>Parameters:</b></dt><dd>
314  <table border="0" cellspacing="2" cellpadding="0">
315    <tr><td valign="top"></td><td valign="top"><em>dh</em>&nbsp;</td><td>DH object. </td></tr>
316    <tr><td valign="top"></td><td valign="top"><em>idx</em>&nbsp;</td><td>index to get the data for.</td></tr>
317  </table>
318</dl>
319<dl class="return" compact><dt><b>Returns:</b></dt><dd>the object store in index idx </dd></dl>
320
321</div>
322</div><p>
323<a class="anchor" name="gbfe13af1fef654a94a9be268df6d8809"></a><!-- doxytag: member="dh-ltm.c::DH_ltm_method" ref="gbfe13af1fef654a94a9be268df6d8809" args="(void)" -->
324<div class="memitem">
325<div class="memproto">
326      <table class="memname">
327        <tr>
328          <td class="memname">const DH_METHOD* DH_ltm_method           </td>
329          <td>(</td>
330          <td class="paramtype">void&nbsp;</td>
331          <td class="paramname">          </td>
332          <td>&nbsp;)&nbsp;</td>
333          <td></td>
334        </tr>
335      </table>
336</div>
337<div class="memdoc">
338
339<p>
340DH implementation using libtommath.<p>
341<dl class="return" compact><dt><b>Returns:</b></dt><dd>the DH_METHOD for the DH implementation using libtommath. </dd></dl>
342
343</div>
344</div><p>
345<a class="anchor" name="g76c6e12bd1f0b9977d80fee83b086031"></a><!-- doxytag: member="dh.c::DH_new" ref="g76c6e12bd1f0b9977d80fee83b086031" args="(void)" -->
346<div class="memitem">
347<div class="memproto">
348      <table class="memname">
349        <tr>
350          <td class="memname">DH* DH_new           </td>
351          <td>(</td>
352          <td class="paramtype">void&nbsp;</td>
353          <td class="paramname">          </td>
354          <td>&nbsp;)&nbsp;</td>
355          <td></td>
356        </tr>
357      </table>
358</div>
359<div class="memdoc">
360
361<p>
362Create a new DH object using DH_new_method(NULL), see <a class="el" href="group__hcrypto__dh.html#g2e97e03aee56c6094bb7fd6322b3ce68">DH_new_method()</a>.<p>
363<dl class="return" compact><dt><b>Returns:</b></dt><dd>a newly allocated DH object. </dd></dl>
364
365</div>
366</div><p>
367<a class="anchor" name="g2e97e03aee56c6094bb7fd6322b3ce68"></a><!-- doxytag: member="dh.c::DH_new_method" ref="g2e97e03aee56c6094bb7fd6322b3ce68" args="(ENGINE *engine)" -->
368<div class="memitem">
369<div class="memproto">
370      <table class="memname">
371        <tr>
372          <td class="memname">DH* DH_new_method           </td>
373          <td>(</td>
374          <td class="paramtype">ENGINE *&nbsp;</td>
375          <td class="paramname"> <em>engine</em>          </td>
376          <td>&nbsp;)&nbsp;</td>
377          <td></td>
378        </tr>
379      </table>
380</div>
381<div class="memdoc">
382
383<p>
384Create 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>
385<dl compact><dt><b>Parameters:</b></dt><dd>
386  <table border="0" cellspacing="2" cellpadding="0">
387    <tr><td valign="top"></td><td valign="top"><em>engine</em>&nbsp;</td><td>The engine to use to allocate the DH object.</td></tr>
388  </table>
389</dl>
390<dl class="return" compact><dt><b>Returns:</b></dt><dd>a newly allocated DH object. </dd></dl>
391
392</div>
393</div><p>
394<a class="anchor" name="g1e3dc0dbc1ba678716d28654c0eded84"></a><!-- doxytag: member="dh.c::DH_null_method" ref="g1e3dc0dbc1ba678716d28654c0eded84" args="(void)" -->
395<div class="memitem">
396<div class="memproto">
397      <table class="memname">
398        <tr>
399          <td class="memname">const DH_METHOD* DH_null_method           </td>
400          <td>(</td>
401          <td class="paramtype">void&nbsp;</td>
402          <td class="paramname">          </td>
403          <td>&nbsp;)&nbsp;</td>
404          <td></td>
405        </tr>
406      </table>
407</div>
408<div class="memdoc">
409
410<p>
411Return the dummy DH implementation.<p>
412<dl class="return" compact><dt><b>Returns:</b></dt><dd>pointer to a DH_METHOD. </dd></dl>
413
414</div>
415</div><p>
416<a class="anchor" name="g6c63e1e8af5957d7f798439c854d06b6"></a><!-- doxytag: member="dh.c::DH_set_default_method" ref="g6c63e1e8af5957d7f798439c854d06b6" args="(const DH_METHOD *meth)" -->
417<div class="memitem">
418<div class="memproto">
419      <table class="memname">
420        <tr>
421          <td class="memname">void DH_set_default_method           </td>
422          <td>(</td>
423          <td class="paramtype">const DH_METHOD *&nbsp;</td>
424          <td class="paramname"> <em>meth</em>          </td>
425          <td>&nbsp;)&nbsp;</td>
426          <td></td>
427        </tr>
428      </table>
429</div>
430<div class="memdoc">
431
432<p>
433Set the default DH implementation.<p>
434<dl compact><dt><b>Parameters:</b></dt><dd>
435  <table border="0" cellspacing="2" cellpadding="0">
436    <tr><td valign="top"></td><td valign="top"><em>meth</em>&nbsp;</td><td>pointer to a DH_METHOD. </td></tr>
437  </table>
438</dl>
439
440</div>
441</div><p>
442<a class="anchor" name="g7a03e7589a8473ed34cf2a4177709c0e"></a><!-- doxytag: member="dh.c::DH_set_ex_data" ref="g7a03e7589a8473ed34cf2a4177709c0e" args="(DH *dh, int idx, void *data)" -->
443<div class="memitem">
444<div class="memproto">
445      <table class="memname">
446        <tr>
447          <td class="memname">int DH_set_ex_data           </td>
448          <td>(</td>
449          <td class="paramtype">DH *&nbsp;</td>
450          <td class="paramname"> <em>dh</em>, </td>
451        </tr>
452        <tr>
453          <td class="paramkey"></td>
454          <td></td>
455          <td class="paramtype">int&nbsp;</td>
456          <td class="paramname"> <em>idx</em>, </td>
457        </tr>
458        <tr>
459          <td class="paramkey"></td>
460          <td></td>
461          <td class="paramtype">void *&nbsp;</td>
462          <td class="paramname"> <em>data</em></td><td>&nbsp;</td>
463        </tr>
464        <tr>
465          <td></td>
466          <td>)</td>
467          <td></td><td></td><td></td>
468        </tr>
469      </table>
470</div>
471<div class="memdoc">
472
473<p>
474Set the data index idx in the DH object to data.<p>
475<dl compact><dt><b>Parameters:</b></dt><dd>
476  <table border="0" cellspacing="2" cellpadding="0">
477    <tr><td valign="top"></td><td valign="top"><em>dh</em>&nbsp;</td><td>DH object. </td></tr>
478    <tr><td valign="top"></td><td valign="top"><em>idx</em>&nbsp;</td><td>index to set the data for. </td></tr>
479    <tr><td valign="top"></td><td valign="top"><em>data</em>&nbsp;</td><td>data to store for the index idx.</td></tr>
480  </table>
481</dl>
482<dl class="return" compact><dt><b>Returns:</b></dt><dd>1 on success. </dd></dl>
483
484</div>
485</div><p>
486<a class="anchor" name="ge8f6c9ec1c2e4904439227a952980fdd"></a><!-- doxytag: member="dh.c::DH_set_method" ref="ge8f6c9ec1c2e4904439227a952980fdd" args="(DH *dh, const DH_METHOD *method)" -->
487<div class="memitem">
488<div class="memproto">
489      <table class="memname">
490        <tr>
491          <td class="memname">int DH_set_method           </td>
492          <td>(</td>
493          <td class="paramtype">DH *&nbsp;</td>
494          <td class="paramname"> <em>dh</em>, </td>
495        </tr>
496        <tr>
497          <td class="paramkey"></td>
498          <td></td>
499          <td class="paramtype">const DH_METHOD *&nbsp;</td>
500          <td class="paramname"> <em>method</em></td><td>&nbsp;</td>
501        </tr>
502        <tr>
503          <td></td>
504          <td>)</td>
505          <td></td><td></td><td></td>
506        </tr>
507      </table>
508</div>
509<div class="memdoc">
510
511<p>
512Set a new method for the DH keypair.<p>
513<dl compact><dt><b>Parameters:</b></dt><dd>
514  <table border="0" cellspacing="2" cellpadding="0">
515    <tr><td valign="top"></td><td valign="top"><em>dh</em>&nbsp;</td><td>dh parameter. </td></tr>
516    <tr><td valign="top"></td><td valign="top"><em>method</em>&nbsp;</td><td>the new method for the DH parameter.</td></tr>
517  </table>
518</dl>
519<dl class="return" compact><dt><b>Returns:</b></dt><dd>1 on success. </dd></dl>
520
521</div>
522</div><p>
523<a class="anchor" name="g9e1fdd62e3bfe4b671dbfc363f0e6297"></a><!-- doxytag: member="dh.c::DH_size" ref="g9e1fdd62e3bfe4b671dbfc363f0e6297" args="(const DH *dh)" -->
524<div class="memitem">
525<div class="memproto">
526      <table class="memname">
527        <tr>
528          <td class="memname">int DH_size           </td>
529          <td>(</td>
530          <td class="paramtype">const DH *&nbsp;</td>
531          <td class="paramname"> <em>dh</em>          </td>
532          <td>&nbsp;)&nbsp;</td>
533          <td></td>
534        </tr>
535      </table>
536</div>
537<div class="memdoc">
538
539<p>
540The maximum output size of the <a class="el" href="group__hcrypto__dh.html#gf8b793df62108341ed3dc54a0ca75ca8">DH_compute_key()</a> function.<p>
541<dl compact><dt><b>Parameters:</b></dt><dd>
542  <table border="0" cellspacing="2" cellpadding="0">
543    <tr><td valign="top"></td><td valign="top"><em>dh</em>&nbsp;</td><td>The DH object to get the size from.</td></tr>
544  </table>
545</dl>
546<dl class="return" compact><dt><b>Returns:</b></dt><dd>the maximum size in bytes of the out data. </dd></dl>
547
548</div>
549</div><p>
550<a class="anchor" name="gf7c3e51cba326865c3684012c2337df1"></a><!-- doxytag: member="dh.c::DH_up_ref" ref="gf7c3e51cba326865c3684012c2337df1" args="(DH *dh)" -->
551<div class="memitem">
552<div class="memproto">
553      <table class="memname">
554        <tr>
555          <td class="memname">int DH_up_ref           </td>
556          <td>(</td>
557          <td class="paramtype">DH *&nbsp;</td>
558          <td class="paramname"> <em>dh</em>          </td>
559          <td>&nbsp;)&nbsp;</td>
560          <td></td>
561        </tr>
562      </table>
563</div>
564<div class="memdoc">
565
566<p>
567Add 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>
568<dl compact><dt><b>Parameters:</b></dt><dd>
569  <table border="0" cellspacing="2" cellpadding="0">
570    <tr><td valign="top"></td><td valign="top"><em>dh</em>&nbsp;</td><td>the object to increase the reference count too.</td></tr>
571  </table>
572</dl>
573<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>
574
575</div>
576</div><p>
577</div>
578<hr size="1"><address style="text-align: right;"><small>
579Generated on Wed Jan 11 14:07:38 2012 for Heimdal crypto library by&nbsp;<a href="http://www.doxygen.org/index.html"><img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.6</small></address>
580</body>
581</html>
582