Sophie

Sophie

distrib > Mageia > 1 > i586 > by-pkgid > e8773dc1178a3ee82e29ab36424dc729 > files > 349

libbeecrypt-devel-4.2.1-6.mga1.i586.rpm

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>BeeCrypt: include/beecrypt/dldp.h Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<!-- Generated by Doxygen 1.7.3 -->
<div id="top">
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td style="padding-left: 0.5em;">
   <div id="projectname">BeeCrypt&#160;<span id="projectnumber">4.2.1</span></div>
  </td>
 </tr>
 </tbody>
</table>
</div>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="pages.html"><span>Related&#160;Pages</span></a></li>
      <li><a href="modules.html"><span>Modules</span></a></li>
      <li><a href="annotated.html"><span>Data&#160;Structures</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&#160;List</span></a></li>
      <li><a href="globals.html"><span>Globals</span></a></li>
    </ul>
  </div>
<div class="header">
  <div class="headertitle">
<h1>include/beecrypt/dldp.h</h1>  </div>
</div>
<div class="contents">
<a href="dldp_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*</span>
<a name="l00002"></a>00002 <span class="comment"> * Copyright (c) 2000, 2001, 2002 X-Way Rights BV</span>
<a name="l00003"></a>00003 <span class="comment"> *</span>
<a name="l00004"></a>00004 <span class="comment"> * This library is free software; you can redistribute it and/or</span>
<a name="l00005"></a>00005 <span class="comment"> * modify it under the terms of the GNU Lesser General Public</span>
<a name="l00006"></a>00006 <span class="comment"> * License as published by the Free Software Foundation; either</span>
<a name="l00007"></a>00007 <span class="comment"> * version 2.1 of the License, or (at your option) any later version.</span>
<a name="l00008"></a>00008 <span class="comment"> *</span>
<a name="l00009"></a>00009 <span class="comment"> * This library is distributed in the hope that it will be useful,</span>
<a name="l00010"></a>00010 <span class="comment"> * but WITHOUT ANY WARRANTY; without even the implied warranty of</span>
<a name="l00011"></a>00011 <span class="comment"> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU</span>
<a name="l00012"></a>00012 <span class="comment"> * Lesser General Public License for more details.</span>
<a name="l00013"></a>00013 <span class="comment"> *</span>
<a name="l00014"></a>00014 <span class="comment"> * You should have received a copy of the GNU Lesser General Public</span>
<a name="l00015"></a>00015 <span class="comment"> * License along with this library; if not, write to the Free Software</span>
<a name="l00016"></a>00016 <span class="comment"> * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA</span>
<a name="l00017"></a>00017 <span class="comment"> *</span>
<a name="l00018"></a>00018 <span class="comment"> */</span>
<a name="l00019"></a>00019 
<a name="l00026"></a>00026 <span class="preprocessor">#ifndef _DLDP_H</span>
<a name="l00027"></a>00027 <span class="preprocessor"></span><span class="preprocessor">#define _DLDP_H</span>
<a name="l00028"></a>00028 <span class="preprocessor"></span>
<a name="l00029"></a>00029 <span class="preprocessor">#include &quot;beecrypt/mpbarrett.h&quot;</span>
<a name="l00030"></a>00030 
<a name="l00031"></a>00031 <span class="comment">/*</span>
<a name="l00032"></a>00032 <span class="comment"> * Discrete Logarithm Domain Parameters - Prime</span>
<a name="l00033"></a>00033 <span class="comment"> *</span>
<a name="l00034"></a>00034 <span class="comment"> * Standard definition where p = qr+1; in case where p=2q+1, r=2</span>
<a name="l00035"></a>00035 <span class="comment"> *</span>
<a name="l00036"></a>00036 <span class="comment"> * In IEEE P1363 naming is p = rk+1</span>
<a name="l00037"></a>00037 <span class="comment"> *</span>
<a name="l00038"></a>00038 <span class="comment"> * Hence, IEEE prime r = q and cofactor k = r</span>
<a name="l00039"></a>00039 <span class="comment"> *</span>
<a name="l00040"></a>00040 <span class="comment"> * Make sure q is large enough to foil Pohlig-Hellman attacks</span>
<a name="l00041"></a>00041 <span class="comment"> *  See: &quot;Handbook of Applied Cryptography&quot;, Chapter 3.6.4</span>
<a name="l00042"></a>00042 <span class="comment"> *</span>
<a name="l00043"></a>00043 <span class="comment"> * g is either a generator of a subgroup of order q, or a generator of order</span>
<a name="l00044"></a>00044 <span class="comment"> *  n = (p-1)</span>
<a name="l00045"></a>00045 <span class="comment"> */</span>
<a name="l00046"></a>00046 
<a name="l00053"></a>00053 <span class="preprocessor">#ifdef __cplusplus</span>
<a name="l00054"></a><a class="code" href="structdldp__p.html">00054</a> <span class="preprocessor"></span><span class="keyword">struct </span><a class="code" href="api_8h.html#a4f699d64328623c51b22f3b3f1ff4150">BEECRYPTAPI</a> <a class="code" href="structdldp__p.html" title="Discrete Logarithm Domain Parameters over a prime field.">dldp_p</a>
<a name="l00055"></a>00055 #else
<a name="l00056"></a>00056 struct _dldp_p
<a name="l00057"></a>00057 #endif
<a name="l00058"></a>00058 {
<a name="l00063"></a><a class="code" href="structdldp__p.html#a0b22119026036065c321efd6749060a8">00063</a>     <a class="code" href="structmpbarrett.html">mpbarrett</a> <a class="code" href="structdldp__p.html#a0b22119026036065c321efd6749060a8" title="The prime.">p</a>;
<a name="l00069"></a><a class="code" href="structdldp__p.html#a23989b1857b354b90f5300d083141914">00069</a>     <a class="code" href="structmpbarrett.html">mpbarrett</a> <a class="code" href="structdldp__p.html#a23989b1857b354b90f5300d083141914" title="The cofactor.">q</a>;
<a name="l00074"></a><a class="code" href="structdldp__p.html#a56fc6c3283f7eb1ab1ffd3864a278ab7">00074</a>     <a class="code" href="structmpnumber.html">mpnumber</a> <a class="code" href="structdldp__p.html#a56fc6c3283f7eb1ab1ffd3864a278ab7">r</a>;
<a name="l00081"></a><a class="code" href="structdldp__p.html#a6336ee138a97160378b5c0385aa82482">00081</a>     <a class="code" href="structmpnumber.html">mpnumber</a> <a class="code" href="structdldp__p.html#a6336ee138a97160378b5c0385aa82482" title="The generator.">g</a>;
<a name="l00086"></a><a class="code" href="structdldp__p.html#a48b80339b040dc326b29bb7b69ca5cfb">00086</a>     <a class="code" href="structmpbarrett.html">mpbarrett</a> <a class="code" href="structdldp__p.html#a48b80339b040dc326b29bb7b69ca5cfb">n</a>;
<a name="l00087"></a>00087 <span class="preprocessor">#ifdef __cplusplus</span>
<a name="l00088"></a>00088 <span class="preprocessor"></span>    <a class="code" href="structdldp__p.html" title="Discrete Logarithm Domain Parameters over a prime field.">dldp_p</a>();
<a name="l00089"></a>00089     <a class="code" href="structdldp__p.html" title="Discrete Logarithm Domain Parameters over a prime field.">dldp_p</a>(<span class="keyword">const</span> <a class="code" href="structdldp__p.html" title="Discrete Logarithm Domain Parameters over a prime field.">dldp_p</a>&amp;);
<a name="l00090"></a>00090     ~<a class="code" href="structdldp__p.html" title="Discrete Logarithm Domain Parameters over a prime field.">dldp_p</a>();
<a name="l00091"></a>00091 <span class="preprocessor">#endif</span>
<a name="l00092"></a>00092 <span class="preprocessor"></span>};
<a name="l00093"></a>00093 
<a name="l00094"></a>00094 <span class="preprocessor">#ifndef __cplusplus</span>
<a name="l00095"></a>00095 <span class="preprocessor"></span><span class="keyword">typedef</span> <span class="keyword">struct </span>_dldp_p <a class="code" href="structdldp__p.html" title="Discrete Logarithm Domain Parameters over a prime field.">dldp_p</a>;
<a name="l00096"></a>00096 <span class="preprocessor">#endif</span>
<a name="l00097"></a>00097 <span class="preprocessor"></span>
<a name="l00098"></a>00098 <span class="preprocessor">#ifdef __cplusplus</span>
<a name="l00099"></a>00099 <span class="preprocessor"></span><span class="keyword">extern</span> <span class="stringliteral">&quot;C&quot;</span> {
<a name="l00100"></a>00100 <span class="preprocessor">#endif</span>
<a name="l00101"></a>00101 <span class="preprocessor"></span>
<a name="l00102"></a>00102 <span class="comment">/*</span>
<a name="l00103"></a>00103 <span class="comment"> * Functions for setting up and copying</span>
<a name="l00104"></a>00104 <span class="comment"> */</span>
<a name="l00105"></a>00105 
<a name="l00106"></a>00106 <a class="code" href="api_8h.html#a4f699d64328623c51b22f3b3f1ff4150">BEECRYPTAPI</a>
<a name="l00107"></a>00107 <span class="keywordtype">int</span> <a class="code" href="dldp_8h.html#a370b4cb101375cf9ddc12d5f03fa8117">dldp_pInit</a>(<a class="code" href="structdldp__p.html" title="Discrete Logarithm Domain Parameters over a prime field.">dldp_p</a>*);
<a name="l00108"></a>00108 <a class="code" href="api_8h.html#a4f699d64328623c51b22f3b3f1ff4150">BEECRYPTAPI</a>
<a name="l00109"></a>00109 <span class="keywordtype">int</span> <a class="code" href="dldp_8h.html#a015e2c66fc42c4f5ade233b3bf225ce3">dldp_pFree</a>(<a class="code" href="structdldp__p.html" title="Discrete Logarithm Domain Parameters over a prime field.">dldp_p</a>*);
<a name="l00110"></a>00110 <a class="code" href="api_8h.html#a4f699d64328623c51b22f3b3f1ff4150">BEECRYPTAPI</a>
<a name="l00111"></a>00111 <span class="keywordtype">int</span> <a class="code" href="dldp_8h.html#a5fdd1c1a8f2232f5e1b7db8b68fa0b2a">dldp_pCopy</a>(<a class="code" href="structdldp__p.html" title="Discrete Logarithm Domain Parameters over a prime field.">dldp_p</a>*, <span class="keyword">const</span> <a class="code" href="structdldp__p.html" title="Discrete Logarithm Domain Parameters over a prime field.">dldp_p</a>*);
<a name="l00112"></a>00112 
<a name="l00113"></a>00113 <span class="comment">/*</span>
<a name="l00114"></a>00114 <span class="comment"> * Functions for generating keys</span>
<a name="l00115"></a>00115 <span class="comment"> */</span>
<a name="l00116"></a>00116 
<a name="l00117"></a>00117 <a class="code" href="api_8h.html#a4f699d64328623c51b22f3b3f1ff4150">BEECRYPTAPI</a>
<a name="l00118"></a>00118 <span class="keywordtype">int</span> <a class="code" href="dldp_8h.html#a3a3dfa79f5775cf9cb21c53749c98e5f">dldp_pPrivate</a>  (<span class="keyword">const</span> <a class="code" href="structdldp__p.html" title="Discrete Logarithm Domain Parameters over a prime field.">dldp_p</a>*, <a class="code" href="structrandomGeneratorContext.html">randomGeneratorContext</a>*, <a class="code" href="structmpnumber.html">mpnumber</a>*);
<a name="l00119"></a>00119 <a class="code" href="api_8h.html#a4f699d64328623c51b22f3b3f1ff4150">BEECRYPTAPI</a>
<a name="l00120"></a>00120 <span class="keywordtype">int</span> <a class="code" href="dldp_8h.html#abf3a3b417f49959fc08aa74bd619a7da">dldp_pPrivate_s</a>(<span class="keyword">const</span> <a class="code" href="structdldp__p.html" title="Discrete Logarithm Domain Parameters over a prime field.">dldp_p</a>*, <a class="code" href="structrandomGeneratorContext.html">randomGeneratorContext</a>*, <a class="code" href="structmpnumber.html">mpnumber</a>*, <span class="keywordtype">size_t</span>);
<a name="l00121"></a>00121 <a class="code" href="api_8h.html#a4f699d64328623c51b22f3b3f1ff4150">BEECRYPTAPI</a>
<a name="l00122"></a>00122 <span class="keywordtype">int</span> <a class="code" href="dldp_8h.html#af375a17e0d23dbbb97417a40c8341423">dldp_pPublic</a>   (<span class="keyword">const</span> <a class="code" href="structdldp__p.html" title="Discrete Logarithm Domain Parameters over a prime field.">dldp_p</a>*, <span class="keyword">const</span> <a class="code" href="structmpnumber.html">mpnumber</a>*, <a class="code" href="structmpnumber.html">mpnumber</a>*);
<a name="l00123"></a>00123 <a class="code" href="api_8h.html#a4f699d64328623c51b22f3b3f1ff4150">BEECRYPTAPI</a>
<a name="l00124"></a>00124 <span class="keywordtype">int</span> <a class="code" href="dldp_8h.html#a30729037aed67858f5a262a4ad580030">dldp_pPair</a>     (<span class="keyword">const</span> <a class="code" href="structdldp__p.html" title="Discrete Logarithm Domain Parameters over a prime field.">dldp_p</a>*, <a class="code" href="structrandomGeneratorContext.html">randomGeneratorContext</a>*, <a class="code" href="structmpnumber.html">mpnumber</a>* x, <a class="code" href="structmpnumber.html">mpnumber</a>* y);
<a name="l00125"></a>00125 <a class="code" href="api_8h.html#a4f699d64328623c51b22f3b3f1ff4150">BEECRYPTAPI</a>
<a name="l00126"></a>00126 <span class="keywordtype">int</span> <a class="code" href="dldp_8h.html#a9564264e664580fb650cc368ad6c28a1">dldp_pPair_s</a>   (<span class="keyword">const</span> <a class="code" href="structdldp__p.html" title="Discrete Logarithm Domain Parameters over a prime field.">dldp_p</a>*, <a class="code" href="structrandomGeneratorContext.html">randomGeneratorContext</a>*, <a class="code" href="structmpnumber.html">mpnumber</a>* x, <a class="code" href="structmpnumber.html">mpnumber</a>* y, <span class="keywordtype">size_t</span>);
<a name="l00127"></a>00127 
<a name="l00128"></a>00128 <span class="comment">/*</span>
<a name="l00129"></a>00129 <span class="comment"> * Function for comparing domain parameters</span>
<a name="l00130"></a>00130 <span class="comment"> */</span>
<a name="l00131"></a>00131 
<a name="l00132"></a>00132 <a class="code" href="api_8h.html#a4f699d64328623c51b22f3b3f1ff4150">BEECRYPTAPI</a>
<a name="l00133"></a>00133 <span class="keywordtype">int</span>  <a class="code" href="dldp_8h.html#ae750cb3291d690ad8937ddd240d2756b">dldp_pEqual</a>  (<span class="keyword">const</span> <a class="code" href="structdldp__p.html" title="Discrete Logarithm Domain Parameters over a prime field.">dldp_p</a>*, <span class="keyword">const</span> <a class="code" href="structdldp__p.html" title="Discrete Logarithm Domain Parameters over a prime field.">dldp_p</a>*);
<a name="l00134"></a>00134 
<a name="l00135"></a>00135 <span class="comment">/*</span>
<a name="l00136"></a>00136 <span class="comment"> * Functions for generating and validating dldp_pgoq variant domain parameters</span>
<a name="l00137"></a>00137 <span class="comment"> */</span>
<a name="l00138"></a>00138 
<a name="l00139"></a>00139 <a class="code" href="api_8h.html#a4f699d64328623c51b22f3b3f1ff4150">BEECRYPTAPI</a>
<a name="l00140"></a>00140 <span class="keywordtype">int</span> <a class="code" href="dldp_8h.html#a3780524c2167b0fad7388af3f92ade7f">dldp_pgoqMake</a>     (<a class="code" href="structdldp__p.html" title="Discrete Logarithm Domain Parameters over a prime field.">dldp_p</a>*, <a class="code" href="structrandomGeneratorContext.html">randomGeneratorContext</a>*, <span class="keywordtype">size_t</span>, <span class="keywordtype">size_t</span>, <span class="keywordtype">int</span>);
<a name="l00141"></a>00141 <a class="code" href="api_8h.html#a4f699d64328623c51b22f3b3f1ff4150">BEECRYPTAPI</a>
<a name="l00142"></a>00142 <span class="keywordtype">int</span> <a class="code" href="dldp_8h.html#ac844b51530e2f21ff57b8e2fa4027ec8">dldp_pgoqMakeSafe</a> (<a class="code" href="structdldp__p.html" title="Discrete Logarithm Domain Parameters over a prime field.">dldp_p</a>*, <a class="code" href="structrandomGeneratorContext.html">randomGeneratorContext</a>*, <span class="keywordtype">size_t</span>);
<a name="l00143"></a>00143 <a class="code" href="api_8h.html#a4f699d64328623c51b22f3b3f1ff4150">BEECRYPTAPI</a>
<a name="l00144"></a>00144 <span class="keywordtype">int</span> <a class="code" href="dldp_8h.html#a047044237de8e5bd20076cca7e773847">dldp_pgoqGenerator</a>(<a class="code" href="structdldp__p.html" title="Discrete Logarithm Domain Parameters over a prime field.">dldp_p</a>*, <a class="code" href="structrandomGeneratorContext.html">randomGeneratorContext</a>*);
<a name="l00145"></a>00145 <a class="code" href="api_8h.html#a4f699d64328623c51b22f3b3f1ff4150">BEECRYPTAPI</a>
<a name="l00146"></a>00146 <span class="keywordtype">int</span>  <a class="code" href="dldp_8h.html#a66900209941a3082c41311be2c49dcf6">dldp_pgoqValidate</a> (<span class="keyword">const</span> <a class="code" href="structdldp__p.html" title="Discrete Logarithm Domain Parameters over a prime field.">dldp_p</a>*, <a class="code" href="structrandomGeneratorContext.html">randomGeneratorContext</a>*, <span class="keywordtype">int</span>);
<a name="l00147"></a>00147 
<a name="l00148"></a>00148 <span class="comment">/*</span>
<a name="l00149"></a>00149 <span class="comment"> * Functions for generating and validating dldp_pgon variant domain parameters</span>
<a name="l00150"></a>00150 <span class="comment"> */</span>
<a name="l00151"></a>00151 
<a name="l00152"></a>00152 <a class="code" href="api_8h.html#a4f699d64328623c51b22f3b3f1ff4150">BEECRYPTAPI</a>
<a name="l00153"></a>00153 <span class="keywordtype">int</span> <a class="code" href="dldp_8h.html#a2915ddec2f6ef94e2aaa00a06cd15389">dldp_pgonMake</a>     (<a class="code" href="structdldp__p.html" title="Discrete Logarithm Domain Parameters over a prime field.">dldp_p</a>*, <a class="code" href="structrandomGeneratorContext.html">randomGeneratorContext</a>*, <span class="keywordtype">size_t</span>, <span class="keywordtype">size_t</span>);
<a name="l00154"></a>00154 <a class="code" href="api_8h.html#a4f699d64328623c51b22f3b3f1ff4150">BEECRYPTAPI</a>
<a name="l00155"></a>00155 <span class="keywordtype">int</span> <a class="code" href="dldp_8h.html#a0ea5a5bba6b5cc123f70040fac2f5db8">dldp_pgonMakeSafe</a> (<a class="code" href="structdldp__p.html" title="Discrete Logarithm Domain Parameters over a prime field.">dldp_p</a>*, <a class="code" href="structrandomGeneratorContext.html">randomGeneratorContext</a>*, <span class="keywordtype">size_t</span>);
<a name="l00156"></a>00156 <a class="code" href="api_8h.html#a4f699d64328623c51b22f3b3f1ff4150">BEECRYPTAPI</a>
<a name="l00157"></a>00157 <span class="keywordtype">int</span> <a class="code" href="dldp_8h.html#ac7579974c014a92101a24aaa9b61df03">dldp_pgonGenerator</a>(<a class="code" href="structdldp__p.html" title="Discrete Logarithm Domain Parameters over a prime field.">dldp_p</a>*, <a class="code" href="structrandomGeneratorContext.html">randomGeneratorContext</a>*);
<a name="l00158"></a>00158 <a class="code" href="api_8h.html#a4f699d64328623c51b22f3b3f1ff4150">BEECRYPTAPI</a>
<a name="l00159"></a>00159 <span class="keywordtype">int</span> <a class="code" href="dldp_8h.html#af5eef8de7d1725a72684cd6500b17f90">dldp_pgonValidate</a> (<span class="keyword">const</span> <a class="code" href="structdldp__p.html" title="Discrete Logarithm Domain Parameters over a prime field.">dldp_p</a>*, <a class="code" href="structrandomGeneratorContext.html">randomGeneratorContext</a>*);
<a name="l00160"></a>00160 
<a name="l00161"></a>00161 <span class="preprocessor">#ifdef __cplusplus</span>
<a name="l00162"></a>00162 <span class="preprocessor"></span>}
<a name="l00163"></a>00163 <span class="preprocessor">#endif</span>
<a name="l00164"></a>00164 <span class="preprocessor"></span>
<a name="l00165"></a>00165 <span class="preprocessor">#endif</span>
</pre></div></div>
</div>
<hr class="footer"/><address class="footer"><small>Generated on Sun Apr 10 2011 20:49:30 for BeeCrypt by&#160;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.3 </small></address>
</body>
</html>