pairing_8c.html 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205
  1. <!-- HTML header for doxygen 1.8.10-->
  2. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  3. <html xmlns="http://www.w3.org/1999/xhtml">
  4. <head>
  5. <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
  6. <meta http-equiv="X-UA-Compatible" content="IE=9"/>
  7. <meta name="generator" content="Doxygen 1.8.11"/>
  8. <title>Intel&reg; Enhanced Privacy ID SDK: epid/common/math/pairing.c File Reference</title>
  9. <link href="tabs.css" rel="stylesheet" type="text/css"/>
  10. <script type="text/javascript" src="jquery.js"></script>
  11. <script type="text/javascript" src="dynsections.js"></script>
  12. <link href="navtree.css" rel="stylesheet" type="text/css"/>
  13. <script type="text/javascript" src="resize.js"></script>
  14. <script type="text/javascript" src="navtreedata.js"></script>
  15. <script type="text/javascript" src="navtree.js"></script>
  16. <script type="text/javascript">
  17. $(document).ready(initResizable);
  18. $(window).load(resizeHeight);
  19. </script>
  20. <link href="doxygen.css" rel="stylesheet" type="text/css" />
  21. <link href="epidstyle.css" rel="stylesheet" type="text/css"/>
  22. </head>
  23. <body>
  24. <div id="top"><!-- do not remove this div, it is closed by doxygen! -->
  25. <div id="titlearea">
  26. <table cellspacing="0" cellpadding="0">
  27. <tbody>
  28. <tr style="height: 56px;">
  29. <td id="projectalign" style="padding-left: 0.5em;">
  30. <div id="projectname"><a
  31. onclick="storeLink('index.html')"
  32. id="projectlink"
  33. class="index.html"
  34. href="index.html">Intel&reg; Enhanced Privacy ID SDK</a>
  35. &#160;<span id="projectnumber">2.0.0</span>
  36. </div>
  37. </td>
  38. </tr>
  39. </tbody>
  40. </table>
  41. </div>
  42. <!-- end header part -->
  43. <!-- Generated by Doxygen 1.8.11 -->
  44. </div><!-- top -->
  45. <div id="side-nav" class="ui-resizable side-nav-resizable">
  46. <div id="nav-tree">
  47. <div id="nav-tree-contents">
  48. <div id="nav-sync" class="sync"></div>
  49. </div>
  50. </div>
  51. <div id="splitbar" style="-moz-user-select:none;"
  52. class="ui-resizable-handle">
  53. </div>
  54. </div>
  55. <script type="text/javascript">
  56. $(document).ready(function(){initNavTree('pairing_8c.html','');});
  57. </script>
  58. <div id="doc-content">
  59. <div class="header">
  60. <div class="summary">
  61. <a href="#nested-classes">Data Structures</a> &#124;
  62. <a href="#define-members">Macros</a> &#124;
  63. <a href="#func-members">Functions</a> </div>
  64. <div class="headertitle">
  65. <div class="title">pairing.c File Reference</div> </div>
  66. </div><!--header-->
  67. <div class="contents">
  68. <p>Pairing implementation.
  69. <a href="#details">More...</a></p>
  70. <div class="textblock"><code>#include &lt;limits.h&gt;</code><br />
  71. <code>#include &quot;<a class="el" href="pairing_8h.html">epid/common/math/pairing.h</a>&quot;</code><br />
  72. <code>#include &quot;epid/common/math/bignum-internal.h&quot;</code><br />
  73. <code>#include &quot;epid/common/math/finitefield-internal.h&quot;</code><br />
  74. <code>#include &quot;epid/common/math/ecgroup-internal.h&quot;</code><br />
  75. <code>#include &quot;epid/common/math/pairing-internal.h&quot;</code><br />
  76. <code>#include &quot;<a class="el" href="memory_8h.html">epid/common/memory.h</a>&quot;</code><br />
  77. <code>#include &quot;ext/ipp/include/ippcp.h&quot;</code><br />
  78. <code>#include &quot;ext/ipp/include/ippcpepid.h&quot;</code><br />
  79. </div><table class="memberdecls">
  80. <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="nested-classes"></a>
  81. Data Structures</h2></td></tr>
  82. <tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="struct_fq_elem_dat.html">FqElemDat</a></td></tr>
  83. <tr class="memdesc:"><td class="mdescLeft">&#160;</td><td class="mdescRight">Data for element in Fq. <a href="struct_fq_elem_dat.html#details">More...</a><br /></td></tr>
  84. <tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
  85. <tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="struct_fq2_elem_dat.html">Fq2ElemDat</a></td></tr>
  86. <tr class="memdesc:"><td class="mdescLeft">&#160;</td><td class="mdescRight">Data for element in Fq2. <a href="struct_fq2_elem_dat.html#details">More...</a><br /></td></tr>
  87. <tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
  88. <tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="struct_fq6_elem_dat.html">Fq6ElemDat</a></td></tr>
  89. <tr class="memdesc:"><td class="mdescLeft">&#160;</td><td class="mdescRight">Data for element in Fq2^3. <a href="struct_fq6_elem_dat.html#details">More...</a><br /></td></tr>
  90. <tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
  91. <tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="struct_fq12_elem_dat.html">Fq12ElemDat</a></td></tr>
  92. <tr class="memdesc:"><td class="mdescLeft">&#160;</td><td class="mdescRight">Data for element in Fq2^3^2. <a href="struct_fq12_elem_dat.html#details">More...</a><br /></td></tr>
  93. <tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
  94. </table><table class="memberdecls">
  95. <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="define-members"></a>
  96. Macros</h2></td></tr>
  97. <tr class="memitem:a05172cee9b4cc2d463a7cd7b66d1123b"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="pairing_8c.html#a05172cee9b4cc2d463a7cd7b66d1123b">BREAK_ON_IPP_ERROR</a>(sts, ret) </td></tr>
  98. <tr class="memdesc:a05172cee9b4cc2d463a7cd7b66d1123b"><td class="mdescLeft">&#160;</td><td class="mdescRight">Handle Ipp Errors with Break. <a href="#a05172cee9b4cc2d463a7cd7b66d1123b">More...</a><br /></td></tr>
  99. <tr class="separator:a05172cee9b4cc2d463a7cd7b66d1123b"><td class="memSeparator" colspan="2">&#160;</td></tr>
  100. <tr class="memitem:ae10abdda5f1cafa6919c41f0d7f7caf8"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="pairing_8c.html#ae10abdda5f1cafa6919c41f0d7f7caf8">RETURN_ON_IPP_ERROR</a>(sts) </td></tr>
  101. <tr class="memdesc:ae10abdda5f1cafa6919c41f0d7f7caf8"><td class="mdescLeft">&#160;</td><td class="mdescRight">Handle Ipp Errors with Return. <a href="#ae10abdda5f1cafa6919c41f0d7f7caf8">More...</a><br /></td></tr>
  102. <tr class="separator:ae10abdda5f1cafa6919c41f0d7f7caf8"><td class="memSeparator" colspan="2">&#160;</td></tr>
  103. <tr class="memitem:a5638f861b82f1746ea1af0b384ef8ff1"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="pairing_8c.html#a5638f861b82f1746ea1af0b384ef8ff1">BREAK_ON_EPID_ERROR</a>(ret)</td></tr>
  104. <tr class="memdesc:a5638f861b82f1746ea1af0b384ef8ff1"><td class="mdescLeft">&#160;</td><td class="mdescRight">Handle SDK Error with Break. <a href="#a5638f861b82f1746ea1af0b384ef8ff1">More...</a><br /></td></tr>
  105. <tr class="separator:a5638f861b82f1746ea1af0b384ef8ff1"><td class="memSeparator" colspan="2">&#160;</td></tr>
  106. </table><table class="memberdecls">
  107. <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
  108. Functions</h2></td></tr>
  109. <tr class="memitem:ga29f79a645871830754d396b9b4a2a0cc"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group___error_codes.html#gafdb27c77c2c4b32c807e326a8a0da360">EpidStatus</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___pairing_primitives.html#ga29f79a645871830754d396b9b4a2a0cc">NewPairingState</a> (<a class="el" href="group___ec_group_primitives.html#gac91c5a7623c17a868dd15b2e9aaf7159">EcGroup</a> const *ga, <a class="el" href="group___ec_group_primitives.html#gac91c5a7623c17a868dd15b2e9aaf7159">EcGroup</a> const *gb, <a class="el" href="group___finite_field_primitives.html#gab281b24e336a8b3d7d90079d862d969e">FiniteField</a> *ff, <a class="el" href="struct_big_num_str.html">BigNumStr</a> const *t, <a class="el" href="stdtypes_8h.html#ad5c9d4ba3dc37783a528b0925dc981a0">bool</a> neg, <a class="el" href="group___pairing_primitives.html#ga3f1fa61d25487f96dfb0ffef4ad35607">PairingState</a> **ps)</td></tr>
  110. <tr class="memdesc:ga29f79a645871830754d396b9b4a2a0cc"><td class="mdescLeft">&#160;</td><td class="mdescRight">Constructs a new Pairing State. <a href="group___pairing_primitives.html#ga29f79a645871830754d396b9b4a2a0cc">More...</a><br /></td></tr>
  111. <tr class="separator:ga29f79a645871830754d396b9b4a2a0cc"><td class="memSeparator" colspan="2">&#160;</td></tr>
  112. <tr class="memitem:gad54aebdc331d39b73000fdca9e04f94d"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___pairing_primitives.html#gad54aebdc331d39b73000fdca9e04f94d">DeletePairingState</a> (<a class="el" href="group___pairing_primitives.html#ga3f1fa61d25487f96dfb0ffef4ad35607">PairingState</a> **ps)</td></tr>
  113. <tr class="memdesc:gad54aebdc331d39b73000fdca9e04f94d"><td class="mdescLeft">&#160;</td><td class="mdescRight">Frees a previously allocated by PairingState. <a href="group___pairing_primitives.html#gad54aebdc331d39b73000fdca9e04f94d">More...</a><br /></td></tr>
  114. <tr class="separator:gad54aebdc331d39b73000fdca9e04f94d"><td class="memSeparator" colspan="2">&#160;</td></tr>
  115. <tr class="memitem:ga5dd07d13536e27c37eaeee285297066c"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group___error_codes.html#gafdb27c77c2c4b32c807e326a8a0da360">EpidStatus</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___pairing_primitives.html#ga5dd07d13536e27c37eaeee285297066c">Pairing</a> (<a class="el" href="group___pairing_primitives.html#ga3f1fa61d25487f96dfb0ffef4ad35607">PairingState</a> *ps, <a class="el" href="group___finite_field_primitives.html#ga6cff5c7c06b07a87442b810ccc0a86fa">FfElement</a> *d, <a class="el" href="group___ec_group_primitives.html#ga85c1d5e106031b385a6e23e598ac98fa">EcPoint</a> const *a, <a class="el" href="group___ec_group_primitives.html#ga85c1d5e106031b385a6e23e598ac98fa">EcPoint</a> const *b)</td></tr>
  116. <tr class="memdesc:ga5dd07d13536e27c37eaeee285297066c"><td class="mdescLeft">&#160;</td><td class="mdescRight">Computes an Optimal Ate Pairing for two parameters. <a href="group___pairing_primitives.html#ga5dd07d13536e27c37eaeee285297066c">More...</a><br /></td></tr>
  117. <tr class="separator:ga5dd07d13536e27c37eaeee285297066c"><td class="memSeparator" colspan="2">&#160;</td></tr>
  118. </table>
  119. <a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
  120. <div class="textblock"><p>Pairing implementation. </p>
  121. </div><h2 class="groupheader">Macro Definition Documentation</h2>
  122. <a class="anchor" id="a5638f861b82f1746ea1af0b384ef8ff1"></a>
  123. <div class="memitem">
  124. <div class="memproto">
  125. <table class="memname">
  126. <tr>
  127. <td class="memname">#define BREAK_ON_EPID_ERROR</td>
  128. <td>(</td>
  129. <td class="paramtype">&#160;</td>
  130. <td class="paramname">ret</td><td>)</td>
  131. <td></td>
  132. </tr>
  133. </table>
  134. </div><div class="memdoc">
  135. <b>Value:</b><div class="fragment"><div class="line"><span class="keywordflow">if</span> (<a class="code" href="group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360a8a6861e14322ca9193498ffc955537f9">kEpidNoErr</a> != (ret)) { \</div><div class="line"> break; \</div><div class="line"> }</div><div class="ttc" id="group___error_codes_html_ggafdb27c77c2c4b32c807e326a8a0da360a8a6861e14322ca9193498ffc955537f9"><div class="ttname"><a href="group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360a8a6861e14322ca9193498ffc955537f9">kEpidNoErr</a></div><div class="ttdoc">no error </div><div class="ttdef"><b>Definition:</b> errors.h:41</div></div>
  136. </div><!-- fragment -->
  137. <p>Handle SDK Error with Break. </p>
  138. </div>
  139. </div>
  140. <a class="anchor" id="a05172cee9b4cc2d463a7cd7b66d1123b"></a>
  141. <div class="memitem">
  142. <div class="memproto">
  143. <table class="memname">
  144. <tr>
  145. <td class="memname">#define BREAK_ON_IPP_ERROR</td>
  146. <td>(</td>
  147. <td class="paramtype">&#160;</td>
  148. <td class="paramname">sts, </td>
  149. </tr>
  150. <tr>
  151. <td class="paramkey"></td>
  152. <td></td>
  153. <td class="paramtype">&#160;</td>
  154. <td class="paramname">ret&#160;</td>
  155. </tr>
  156. <tr>
  157. <td></td>
  158. <td>)</td>
  159. <td></td><td></td>
  160. </tr>
  161. </table>
  162. </div><div class="memdoc">
  163. <b>Value:</b><div class="fragment"><div class="line">{ \</div><div class="line"> IppStatus temp_sts = (sts); \</div><div class="line"> if (ippStsNoErr != temp_sts) { \</div><div class="line"> if (ippStsContextMatchErr == temp_sts) { \</div><div class="line"> (ret) = <a class="code" href="group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360a1739ecb620f4bede2e1b84e52a96cee6">kEpidMathErr</a>; \</div><div class="line"> } <span class="keywordflow">else</span> { \</div><div class="line"> (ret) = <a class="code" href="group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360ad134d6cc95a9dcb1b1a9f9c358047cbf">kEpidBadArgErr</a>; \</div><div class="line"> } \</div><div class="line"> break; \</div><div class="line"> } \</div><div class="line"> }</div><div class="ttc" id="group___error_codes_html_ggafdb27c77c2c4b32c807e326a8a0da360a1739ecb620f4bede2e1b84e52a96cee6"><div class="ttname"><a href="group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360a1739ecb620f4bede2e1b84e52a96cee6">kEpidMathErr</a></div><div class="ttdoc">internal math error </div><div class="ttdef"><b>Definition:</b> errors.h:53</div></div>
  164. <div class="ttc" id="group___error_codes_html_ggafdb27c77c2c4b32c807e326a8a0da360ad134d6cc95a9dcb1b1a9f9c358047cbf"><div class="ttname"><a href="group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360ad134d6cc95a9dcb1b1a9f9c358047cbf">kEpidBadArgErr</a></div><div class="ttdoc">incorrect arg to function </div><div class="ttdef"><b>Definition:</b> errors.h:50</div></div>
  165. </div><!-- fragment -->
  166. <p>Handle Ipp Errors with Break. </p>
  167. </div>
  168. </div>
  169. <a class="anchor" id="ae10abdda5f1cafa6919c41f0d7f7caf8"></a>
  170. <div class="memitem">
  171. <div class="memproto">
  172. <table class="memname">
  173. <tr>
  174. <td class="memname">#define RETURN_ON_IPP_ERROR</td>
  175. <td>(</td>
  176. <td class="paramtype">&#160;</td>
  177. <td class="paramname">sts</td><td>)</td>
  178. <td></td>
  179. </tr>
  180. </table>
  181. </div><div class="memdoc">
  182. <b>Value:</b><div class="fragment"><div class="line">{ \</div><div class="line"> IppStatus temp_sts = (sts); \</div><div class="line"> if (ippStsNoErr != temp_sts) { \</div><div class="line"> if (ippStsContextMatchErr == temp_sts) { \</div><div class="line"> return <a class="code" href="group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360a1739ecb620f4bede2e1b84e52a96cee6">kEpidMathErr</a>; \</div><div class="line"> } <span class="keywordflow">else</span> { \</div><div class="line"> return <a class="code" href="group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360ad134d6cc95a9dcb1b1a9f9c358047cbf">kEpidBadArgErr</a>; \</div><div class="line"> } \</div><div class="line"> } \</div><div class="line"> }</div><div class="ttc" id="group___error_codes_html_ggafdb27c77c2c4b32c807e326a8a0da360a1739ecb620f4bede2e1b84e52a96cee6"><div class="ttname"><a href="group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360a1739ecb620f4bede2e1b84e52a96cee6">kEpidMathErr</a></div><div class="ttdoc">internal math error </div><div class="ttdef"><b>Definition:</b> errors.h:53</div></div>
  183. <div class="ttc" id="group___error_codes_html_ggafdb27c77c2c4b32c807e326a8a0da360ad134d6cc95a9dcb1b1a9f9c358047cbf"><div class="ttname"><a href="group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360ad134d6cc95a9dcb1b1a9f9c358047cbf">kEpidBadArgErr</a></div><div class="ttdoc">incorrect arg to function </div><div class="ttdef"><b>Definition:</b> errors.h:50</div></div>
  184. </div><!-- fragment -->
  185. <p>Handle Ipp Errors with Return. </p>
  186. </div>
  187. </div>
  188. </div><!-- contents -->
  189. </div><!-- doc-content -->
  190. <!-- HTML footer for doxygen 1.8.10-->
  191. <!-- start footer part -->
  192. <div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  193. <ul>
  194. <li class="navelem"><a class="el" href="dir_12b90d9c027aaf878a834df729679a56.html">epid</a></li><li class="navelem"><a class="el" href="dir_f6bef457d5f671b6e774bfccc16651f6.html">common</a></li><li class="navelem"><a class="el" href="dir_f169ebf8da29290a918fa4b3f7151050.html">math</a></li><li class="navelem"><a class="el" href="pairing_8c.html">pairing.c</a></li>
  195. <li class="footer">
  196. &copy; 2016 Intel Corporation
  197. </li>
  198. </ul>
  199. </div>
  200. </body>
  201. </html>