| <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://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"/> |
| <meta http-equiv="X-UA-Compatible" content="IE=9"/> |
| <meta name="generator" content="Doxygen 1.9.1"/> |
| <meta name="viewport" content="width=device-width, initial-scale=1"/> |
| <title>libmpc: commitments.h Source File</title> |
| <link href="tabs.css" rel="stylesheet" type="text/css"/> |
| <script type="text/javascript" src="jquery.js"></script> |
| <script type="text/javascript" src="dynsections.js"></script> |
| <link href="search/search.css" rel="stylesheet" type="text/css"/> |
| <script type="text/javascript" src="search/searchdata.js"></script> |
| <script type="text/javascript" src="search/search.js"></script> |
| <script type="text/x-mathjax-config"> |
| MathJax.Hub.Config({ |
| extensions: ["tex2jax.js"], |
| jax: ["input/TeX","output/HTML-CSS"], |
| }); |
| </script> |
| <script type="text/javascript" async="async" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js"></script> |
| <link href="doxygen.css" rel="stylesheet" type="text/css" /> |
| </head> |
| <body> |
| <div id="top"><!-- do not remove this div, it is closed by doxygen! --> |
| <div id="titlearea"> |
| <table cellspacing="0" cellpadding="0"> |
| <tbody> |
| <tr style="height: 56px;"> |
| <td id="projectalign" style="padding-left: 0.5em;"> |
| <div id="projectname">libmpc |
| </div> |
| </td> |
| </tr> |
| </tbody> |
| </table> |
| </div> |
| <!-- end header part --> |
| <!-- Generated by Doxygen 1.9.1 --> |
| <script type="text/javascript"> |
| /* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */ |
| var searchBox = new SearchBox("searchBox", "search",false,'Search','.html'); |
| /* @license-end */ |
| </script> |
| <script type="text/javascript" src="menudata.js"></script> |
| <script type="text/javascript" src="menu.js"></script> |
| <script type="text/javascript"> |
| /* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */ |
| $(function() { |
| initMenu('',true,false,'search.php','Search'); |
| $(document).ready(function() { init_search(); }); |
| }); |
| /* @license-end */</script> |
| <div id="main-nav"></div> |
| <!-- window showing the filter options --> |
| <div id="MSearchSelectWindow" |
| onmouseover="return searchBox.OnSearchSelectShow()" |
| onmouseout="return searchBox.OnSearchSelectHide()" |
| onkeydown="return searchBox.OnSearchSelectKey(event)"> |
| </div> |
| |
| <!-- iframe showing the search results (closed by default) --> |
| <div id="MSearchResultsWindow"> |
| <iframe src="javascript:void(0)" frameborder="0" |
| name="MSearchResults" id="MSearchResults"> |
| </iframe> |
| </div> |
| |
| <div id="nav-path" class="navpath"> |
| <ul> |
| <li class="navelem"><a class="el" href="dir_d44c64559bbebec7f509842c48db8b23.html">include</a></li><li class="navelem"><a class="el" href="dir_a166689341c37329f24f96bdba87a08b.html">amcl</a></li> </ul> |
| </div> |
| </div><!-- top --> |
| <div class="header"> |
| <div class="headertitle"> |
| <div class="title">commitments.h</div> </div> |
| </div><!--header--> |
| <div class="contents"> |
| <a href="commitments_8h.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno"> 1</span> <span class="comment">/*</span></div> |
| <div class="line"><a name="l00002"></a><span class="lineno"> 2</span> <span class="comment">Licensed to the Apache Software Foundation (ASF) under one</span></div> |
| <div class="line"><a name="l00003"></a><span class="lineno"> 3</span> <span class="comment">or more contributor license agreements. See the NOTICE file</span></div> |
| <div class="line"><a name="l00004"></a><span class="lineno"> 4</span> <span class="comment">distributed with this work for additional information</span></div> |
| <div class="line"><a name="l00005"></a><span class="lineno"> 5</span> <span class="comment">regarding copyright ownership. The ASF licenses this file</span></div> |
| <div class="line"><a name="l00006"></a><span class="lineno"> 6</span> <span class="comment">to you under the Apache License, Version 2.0 (the</span></div> |
| <div class="line"><a name="l00007"></a><span class="lineno"> 7</span> <span class="comment">"License"); you may not use this file except in compliance</span></div> |
| <div class="line"><a name="l00008"></a><span class="lineno"> 8</span> <span class="comment">with the License. You may obtain a copy of the License at</span></div> |
| <div class="line"><a name="l00009"></a><span class="lineno"> 9</span> <span class="comment"></span> </div> |
| <div class="line"><a name="l00010"></a><span class="lineno"> 10</span> <span class="comment"> http://www.apache.org/licenses/LICENSE-2.0</span></div> |
| <div class="line"><a name="l00011"></a><span class="lineno"> 11</span> <span class="comment"></span> </div> |
| <div class="line"><a name="l00012"></a><span class="lineno"> 12</span> <span class="comment">Unless required by applicable law or agreed to in writing,</span></div> |
| <div class="line"><a name="l00013"></a><span class="lineno"> 13</span> <span class="comment">software distributed under the License is distributed on an</span></div> |
| <div class="line"><a name="l00014"></a><span class="lineno"> 14</span> <span class="comment">"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY</span></div> |
| <div class="line"><a name="l00015"></a><span class="lineno"> 15</span> <span class="comment">KIND, either express or implied. See the License for the</span></div> |
| <div class="line"><a name="l00016"></a><span class="lineno"> 16</span> <span class="comment">specific language governing permissions and limitations</span></div> |
| <div class="line"><a name="l00017"></a><span class="lineno"> 17</span> <span class="comment">under the License.</span></div> |
| <div class="line"><a name="l00018"></a><span class="lineno"> 18</span> <span class="comment">*/</span></div> |
| <div class="line"><a name="l00019"></a><span class="lineno"> 19</span>  </div> |
| <div class="line"><a name="l00026"></a><span class="lineno"> 26</span> <span class="preprocessor">#ifndef COMMITMENTS_H</span></div> |
| <div class="line"><a name="l00027"></a><span class="lineno"> 27</span> <span class="preprocessor">#define COMMITMENTS_H</span></div> |
| <div class="line"><a name="l00028"></a><span class="lineno"> 28</span>  </div> |
| <div class="line"><a name="l00029"></a><span class="lineno"> 29</span> <span class="preprocessor">#include "amcl/amcl.h"</span></div> |
| <div class="line"><a name="l00030"></a><span class="lineno"> 30</span> <span class="preprocessor">#include "amcl/ff_2048.h"</span></div> |
| <div class="line"><a name="l00031"></a><span class="lineno"> 31</span>  </div> |
| <div class="line"><a name="l00032"></a><span class="lineno"> 32</span> <span class="preprocessor">#ifdef __cplusplus</span></div> |
| <div class="line"><a name="l00033"></a><span class="lineno"> 33</span> <span class="keyword">extern</span> <span class="stringliteral">"C"</span></div> |
| <div class="line"><a name="l00034"></a><span class="lineno"> 34</span> {</div> |
| <div class="line"><a name="l00035"></a><span class="lineno"> 35</span> <span class="preprocessor">#endif</span></div> |
| <div class="line"><a name="l00036"></a><span class="lineno"> 36</span>  </div> |
| <div class="line"><a name="l00037"></a><span class="lineno"><a class="line" href="commitments_8h.html#a296158654474a636d999781ddcb9f9d8"> 37</a></span> <span class="preprocessor">#define COMMITMENTS_OK 0 </span></div> |
| <div class="line"><a name="l00038"></a><span class="lineno"><a class="line" href="commitments_8h.html#a0280d7c876b77a0bae100933dc61c9bb"> 38</a></span> <span class="preprocessor">#define COMMITMENTS_FAIL 81 </span></div> |
| <div class="line"><a name="l00040"></a><span class="lineno"> 40</span> <span class="comment">/* NM Commitment Scheme API */</span></div> |
| <div class="line"><a name="l00041"></a><span class="lineno"> 41</span>  </div> |
| <div class="line"><a name="l00049"></a><span class="lineno"><a class="line" href="commitments_8h.html#a03557be3cbf16370e9113fff93bc8169"> 49</a></span> <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="commitments_8h.html#a03557be3cbf16370e9113fff93bc8169">COMMITMENTS_NM_commit</a>(csprng *RNG, <span class="keyword">const</span> octet *X, octet *R, octet *C);</div> |
| <div class="line"><a name="l00050"></a><span class="lineno"> 50</span>  </div> |
| <div class="line"><a name="l00058"></a><span class="lineno"><a class="line" href="commitments_8h.html#a224adcc226ada8b5b999db0ff00f0986"> 58</a></span> <span class="keyword">extern</span> <span class="keywordtype">int</span> <a class="code" href="commitments_8h.html#a224adcc226ada8b5b999db0ff00f0986">COMMITMENTS_NM_decommit</a>(<span class="keyword">const</span> octet* X, <span class="keyword">const</span> octet* R, octet* C);</div> |
| <div class="line"><a name="l00059"></a><span class="lineno"> 59</span>  </div> |
| <div class="line"><a name="l00060"></a><span class="lineno"> 60</span> <span class="comment">/* Bit Commitment Setup API */</span></div> |
| <div class="line"><a name="l00061"></a><span class="lineno"> 61</span>  </div> |
| <div class="line"><a name="l00062"></a><span class="lineno"> 62</span> <span class="preprocessor">#ifndef FS_2048</span></div> |
| <div class="line"><a name="l00063"></a><span class="lineno"><a class="line" href="commitments_8h.html#ae3ce9abc99cec679346a7d38bed96d9b"> 63</a></span> <span class="preprocessor">#define FS_2048 MODBYTES_1024_58 * FFLEN_2048 </span></div> |
| <div class="line"><a name="l00064"></a><span class="lineno"> 64</span> <span class="preprocessor">#endif</span></div> |
| <div class="line"><a name="l00065"></a><span class="lineno"> 65</span> <span class="preprocessor">#ifndef HFS_2048</span></div> |
| <div class="line"><a name="l00066"></a><span class="lineno"><a class="line" href="commitments_8h.html#af12daa3ccdbe8c973ca455b53f58f13b"> 66</a></span> <span class="preprocessor">#define HFS_2048 MODBYTES_1024_58 * HFLEN_2048 </span></div> |
| <div class="line"><a name="l00067"></a><span class="lineno"> 67</span> <span class="preprocessor">#endif</span></div> |
| <div class="line"><a name="l00068"></a><span class="lineno"> 68</span>  </div> |
| <div class="line"><a name="l00070"></a><span class="lineno"><a class="line" href="structCOMMITMENTS__BC__priv__modulus.html"> 70</a></span> <span class="keyword">typedef</span> <span class="keyword">struct</span></div> |
| <div class="line"><a name="l00071"></a><span class="lineno"> 71</span> {</div> |
| <div class="line"><a name="l00072"></a><span class="lineno"><a class="line" href="structCOMMITMENTS__BC__priv__modulus.html#adf198e18dddecfc16a1575d340597f08"> 72</a></span>  BIG_1024_58 P[HFLEN_2048]; </div> |
| <div class="line"><a name="l00073"></a><span class="lineno"><a class="line" href="structCOMMITMENTS__BC__priv__modulus.html#ad85ce137db71ea1fc185c2ca320c1f07"> 73</a></span>  BIG_1024_58 Q[HFLEN_2048]; </div> |
| <div class="line"><a name="l00074"></a><span class="lineno"><a class="line" href="structCOMMITMENTS__BC__priv__modulus.html#a50bb8437f9bd452e123decb02fa91aaa"> 74</a></span>  BIG_1024_58 invPQ[HFLEN_2048]; </div> |
| <div class="line"><a name="l00075"></a><span class="lineno"><a class="line" href="structCOMMITMENTS__BC__priv__modulus.html#a68de71c8f0e75e7f2085dc213a3c3214"> 75</a></span>  BIG_1024_58 pq[FFLEN_2048]; </div> |
| <div class="line"><a name="l00076"></a><span class="lineno"><a class="line" href="structCOMMITMENTS__BC__priv__modulus.html#ae70b46cbe352068e8b8071f0e046d464"> 76</a></span>  BIG_1024_58 N[FFLEN_2048]; </div> |
| <div class="line"><a name="l00077"></a><span class="lineno"><a class="line" href="structCOMMITMENTS__BC__priv__modulus.html#af4ddfbbfc46a62addce247732f82748c"> 77</a></span>  BIG_1024_58 alpha[FFLEN_2048]; </div> |
| <div class="line"><a name="l00078"></a><span class="lineno"><a class="line" href="structCOMMITMENTS__BC__priv__modulus.html#ac2e85b032336fcc302312016986f92e0"> 78</a></span>  BIG_1024_58 ialpha[FFLEN_2048]; </div> |
| <div class="line"><a name="l00079"></a><span class="lineno"><a class="line" href="structCOMMITMENTS__BC__priv__modulus.html#ad21b260d4a4ea65d15d1bac83d738caa"> 79</a></span>  BIG_1024_58 b0[FFLEN_2048]; </div> |
| <div class="line"><a name="l00080"></a><span class="lineno"><a class="line" href="structCOMMITMENTS__BC__priv__modulus.html#a4c83fb166445c451b0e7bcd2419fb032"> 80</a></span>  BIG_1024_58 b1[FFLEN_2048]; </div> |
| <div class="line"><a name="l00081"></a><span class="lineno"> 81</span> } <a class="code" href="structCOMMITMENTS__BC__priv__modulus.html">COMMITMENTS_BC_priv_modulus</a>;</div> |
| <div class="line"><a name="l00082"></a><span class="lineno"> 82</span>  </div> |
| <div class="line"><a name="l00084"></a><span class="lineno"><a class="line" href="structCOMMITMENTS__BC__pub__modulus.html"> 84</a></span> <span class="keyword">typedef</span> <span class="keyword">struct</span></div> |
| <div class="line"><a name="l00085"></a><span class="lineno"> 85</span> {</div> |
| <div class="line"><a name="l00086"></a><span class="lineno"><a class="line" href="structCOMMITMENTS__BC__pub__modulus.html#a55b541b8cd4e0dcdc63c0786b32d4beb"> 86</a></span>  BIG_1024_58 N[FFLEN_2048]; </div> |
| <div class="line"><a name="l00087"></a><span class="lineno"><a class="line" href="structCOMMITMENTS__BC__pub__modulus.html#a762d49ff299040ad437c6b970e063e1f"> 87</a></span>  BIG_1024_58 b0[FFLEN_2048]; </div> |
| <div class="line"><a name="l00088"></a><span class="lineno"><a class="line" href="structCOMMITMENTS__BC__pub__modulus.html#a750b04eab3d90c2b79e20ec7cc638ffe"> 88</a></span>  BIG_1024_58 b1[FFLEN_2048]; </div> |
| <div class="line"><a name="l00089"></a><span class="lineno"> 89</span> } <a class="code" href="structCOMMITMENTS__BC__pub__modulus.html">COMMITMENTS_BC_pub_modulus</a>;</div> |
| <div class="line"><a name="l00090"></a><span class="lineno"> 90</span>  </div> |
| <div class="line"><a name="l00107"></a><span class="lineno"><a class="line" href="commitments_8h.html#a522d6f485494a7a2297007121529db4a"> 107</a></span> <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="commitments_8h.html#a522d6f485494a7a2297007121529db4a">COMMITMENTS_BC_setup</a>(csprng *RNG, <a class="code" href="structCOMMITMENTS__BC__priv__modulus.html">COMMITMENTS_BC_priv_modulus</a> *m, octet *P, octet *Q, octet *B0, octet *ALPHA);</div> |
| <div class="line"><a name="l00108"></a><span class="lineno"> 108</span>  </div> |
| <div class="line"><a name="l00113"></a><span class="lineno"><a class="line" href="commitments_8h.html#a347b682fd4742fff73a9c924c88254ce"> 113</a></span> <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="commitments_8h.html#a347b682fd4742fff73a9c924c88254ce">COMMITMENTS_BC_kill_priv_modulus</a>(<a class="code" href="structCOMMITMENTS__BC__priv__modulus.html">COMMITMENTS_BC_priv_modulus</a> *m);</div> |
| <div class="line"><a name="l00114"></a><span class="lineno"> 114</span>  </div> |
| <div class="line"><a name="l00120"></a><span class="lineno"><a class="line" href="commitments_8h.html#ad1c607c0e295be5b496475c3c4959fad"> 120</a></span> <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="commitments_8h.html#ad1c607c0e295be5b496475c3c4959fad">COMMITMENTS_BC_export_public_modulus</a>(<a class="code" href="structCOMMITMENTS__BC__pub__modulus.html">COMMITMENTS_BC_pub_modulus</a> *pub, <a class="code" href="structCOMMITMENTS__BC__priv__modulus.html">COMMITMENTS_BC_priv_modulus</a> *priv);</div> |
| <div class="line"><a name="l00121"></a><span class="lineno"> 121</span>  </div> |
| <div class="line"><a name="l00122"></a><span class="lineno"> 122</span> <span class="preprocessor">#ifdef __cplusplus</span></div> |
| <div class="line"><a name="l00123"></a><span class="lineno"> 123</span> }</div> |
| <div class="line"><a name="l00124"></a><span class="lineno"> 124</span> <span class="preprocessor">#endif</span></div> |
| <div class="line"><a name="l00125"></a><span class="lineno"> 125</span>  </div> |
| <div class="line"><a name="l00126"></a><span class="lineno"> 126</span> <span class="preprocessor">#endif</span></div> |
| <div class="ttc" id="acommitments_8h_html_a03557be3cbf16370e9113fff93bc8169"><div class="ttname"><a href="commitments_8h.html#a03557be3cbf16370e9113fff93bc8169">COMMITMENTS_NM_commit</a></div><div class="ttdeci">void COMMITMENTS_NM_commit(csprng *RNG, const octet *X, octet *R, octet *C)</div><div class="ttdoc">Generate a commitment for the value X.</div></div> |
| <div class="ttc" id="acommitments_8h_html_a224adcc226ada8b5b999db0ff00f0986"><div class="ttname"><a href="commitments_8h.html#a224adcc226ada8b5b999db0ff00f0986">COMMITMENTS_NM_decommit</a></div><div class="ttdeci">int COMMITMENTS_NM_decommit(const octet *X, const octet *R, octet *C)</div><div class="ttdoc">Decommit the value X.</div></div> |
| <div class="ttc" id="acommitments_8h_html_a347b682fd4742fff73a9c924c88254ce"><div class="ttname"><a href="commitments_8h.html#a347b682fd4742fff73a9c924c88254ce">COMMITMENTS_BC_kill_priv_modulus</a></div><div class="ttdeci">void COMMITMENTS_BC_kill_priv_modulus(COMMITMENTS_BC_priv_modulus *m)</div><div class="ttdoc">Clean secret values from the modulus.</div></div> |
| <div class="ttc" id="acommitments_8h_html_a522d6f485494a7a2297007121529db4a"><div class="ttname"><a href="commitments_8h.html#a522d6f485494a7a2297007121529db4a">COMMITMENTS_BC_setup</a></div><div class="ttdeci">void COMMITMENTS_BC_setup(csprng *RNG, COMMITMENTS_BC_priv_modulus *m, octet *P, octet *Q, octet *B0, octet *ALPHA)</div><div class="ttdoc">Set up an RSA modulus and the necessary values.</div></div> |
| <div class="ttc" id="acommitments_8h_html_ad1c607c0e295be5b496475c3c4959fad"><div class="ttname"><a href="commitments_8h.html#ad1c607c0e295be5b496475c3c4959fad">COMMITMENTS_BC_export_public_modulus</a></div><div class="ttdeci">void COMMITMENTS_BC_export_public_modulus(COMMITMENTS_BC_pub_modulus *pub, COMMITMENTS_BC_priv_modulus *priv)</div><div class="ttdoc">Export the public part of the modulus.</div></div> |
| <div class="ttc" id="astructCOMMITMENTS__BC__priv__modulus_html"><div class="ttname"><a href="structCOMMITMENTS__BC__priv__modulus.html">COMMITMENTS_BC_priv_modulus</a></div><div class="ttdoc">RSA modulus for Bit Commitment.</div><div class="ttdef"><b>Definition:</b> commitments.h:71</div></div> |
| <div class="ttc" id="astructCOMMITMENTS__BC__pub__modulus_html"><div class="ttname"><a href="structCOMMITMENTS__BC__pub__modulus.html">COMMITMENTS_BC_pub_modulus</a></div><div class="ttdoc">Public RSA modulus for Bit Commitment.</div><div class="ttdef"><b>Definition:</b> commitments.h:85</div></div> |
| </div><!-- fragment --></div><!-- contents --> |
| <!-- start footer part --> |
| <hr class="footer"/><address class="footer"><small> |
| Generated by <a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.1 |
| </small></address> |
| </body> |
| </html> |