verifysig_8c-example.html 26 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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: verifysig.c</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('verifysig_8c-example.html','');});
  57. </script>
  58. <div id="doc-content">
  59. <div class="header">
  60. <div class="headertitle">
  61. <div class="title">verifysig.c</div> </div>
  62. </div><!--header-->
  63. <div class="contents">
  64. <p>This is an example of how to call the SDK verifier APIs.</p>
  65. <div class="fragment"><div class="line"><span class="comment">/*############################################################################</span></div><div class="line"><span class="comment"> # Copyright 2016 Intel Corporation</span></div><div class="line"><span class="comment"> #</span></div><div class="line"><span class="comment"> # Licensed under the Apache License, Version 2.0 (the &quot;License&quot;);</span></div><div class="line"><span class="comment"> # you may not use this file except in compliance with the License.</span></div><div class="line"><span class="comment"> # You may obtain a copy of the License at</span></div><div class="line"><span class="comment"> #</span></div><div class="line"><span class="comment"> # http://www.apache.org/licenses/LICENSE-2.0</span></div><div class="line"><span class="comment"> #</span></div><div class="line"><span class="comment"> # Unless required by applicable law or agreed to in writing, software</span></div><div class="line"><span class="comment"> # distributed under the License is distributed on an &quot;AS IS&quot; BASIS,</span></div><div class="line"><span class="comment"> # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.</span></div><div class="line"><span class="comment"> # See the License for the specific language governing permissions and</span></div><div class="line"><span class="comment"> # limitations under the License.</span></div><div class="line"><span class="comment"> ############################################################################*/</span></div><div class="line"></div><div class="line"><span class="preprocessor">#include &quot;src/verifysig.h&quot;</span></div><div class="line"></div><div class="line"><span class="preprocessor">#include &lt;stdlib.h&gt;</span></div><div class="line"></div><div class="line"><span class="preprocessor">#include &quot;util/buffutil.h&quot;</span></div><div class="line"><span class="preprocessor">#include &quot;util/envutil.h&quot;</span></div><div class="line"></div><div class="line"><span class="keywordtype">bool</span> IsCaCertAuthorizedByRootCa(<span class="keywordtype">void</span> <span class="keyword">const</span>* data, <span class="keywordtype">size_t</span> size) {</div><div class="line"> <span class="comment">// Implementation of this function is out of scope of the sample.</span></div><div class="line"> <span class="comment">// In an actual implementation Issuing CA certificate must be validated</span></div><div class="line"> <span class="comment">// with CA Root certificate before using it in parse functions.</span></div><div class="line"> (void)data;</div><div class="line"> (void)size;</div><div class="line"> <span class="keywordflow">return</span> <span class="keyword">true</span>;</div><div class="line">}</div><div class="line"></div><div class="line"></div><div class="line"><a class="code" href="group___error_codes.html#gafdb27c77c2c4b32c807e326a8a0da360">EpidStatus</a> AuthenticateAndAllocateRl(<span class="keywordtype">void</span> <span class="keyword">const</span>* buf, <span class="keywordtype">size_t</span> len,</div><div class="line"> <a name="_a0"></a><a class="code" href="struct_epid_ca_certificate.html">EpidCaCertificate</a> <span class="keyword">const</span>* cert,</div><div class="line"> <a class="code" href="group___file_parser.html#ga9a33be7edc6b4c7a867fb07bd2bddecb">EpidFileType</a> file_type, <span class="keyword">const</span> <span class="keywordtype">char</span>* name,</div><div class="line"> <span class="keywordtype">void</span>** new_rl, <span class="keywordtype">size_t</span>* rl_len);</div><div class="line"></div><div class="line"><a class="code" href="group___error_codes.html#gafdb27c77c2c4b32c807e326a8a0da360">EpidStatus</a> Verify(<a name="_a1"></a><a class="code" href="struct_epid_signature.html">EpidSignature</a> <span class="keyword">const</span>* sig, <span class="keywordtype">size_t</span> sig_len, <span class="keywordtype">void</span> <span class="keyword">const</span>* msg,</div><div class="line"> <span class="keywordtype">size_t</span> msg_len, <span class="keywordtype">void</span> <span class="keyword">const</span>* basename, <span class="keywordtype">size_t</span> basename_len,</div><div class="line"> <span class="keywordtype">void</span> <span class="keyword">const</span>* signed_priv_rl, <span class="keywordtype">size_t</span> signed_priv_rl_size,</div><div class="line"> <span class="keywordtype">void</span> <span class="keyword">const</span>* signed_sig_rl, <span class="keywordtype">size_t</span> signed_sig_rl_size,</div><div class="line"> <span class="keywordtype">void</span> <span class="keyword">const</span>* signed_grp_rl, <span class="keywordtype">size_t</span> signed_grp_rl_size,</div><div class="line"> <a name="_a2"></a><a class="code" href="struct_verifier_rl.html">VerifierRl</a> <span class="keyword">const</span>* ver_rl, <span class="keywordtype">size_t</span> ver_rl_size,</div><div class="line"> <span class="keywordtype">void</span> <span class="keyword">const</span>* signed_pub_key, <span class="keywordtype">size_t</span> signed_pub_key_size,</div><div class="line"> <a class="code" href="struct_epid_ca_certificate.html">EpidCaCertificate</a> <span class="keyword">const</span>* cacert, <a class="code" href="group___epid_types.html#ga5e450438f6f9a5eacd0cf5ce354ec890">HashAlg</a> hash_alg,</div><div class="line"> <a name="_a3"></a><a class="code" href="struct_verifier_precomp.html">VerifierPrecomp</a>* precomp, <span class="keywordtype">bool</span> is_precomp_init) {</div><div class="line"> <a class="code" href="group___error_codes.html#gafdb27c77c2c4b32c807e326a8a0da360">EpidStatus</a> result = <a name="a4"></a><a class="code" href="group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360aa08f0d2e394b37694117a6a32bc71e6e">kEpidErr</a>;</div><div class="line"> <a name="_a5"></a><a class="code" href="struct_verifier_ctx.html">VerifierCtx</a>* ctx = NULL;</div><div class="line"></div><div class="line"> <a name="_a6"></a><a class="code" href="struct_priv_rl.html">PrivRl</a>* priv_rl = NULL;</div><div class="line"> <span class="keywordtype">size_t</span> priv_rl_size = 0;</div><div class="line"> <a name="_a7"></a><a class="code" href="struct_sig_rl.html">SigRl</a>* sig_rl = NULL;</div><div class="line"> <span class="keywordtype">size_t</span> sig_rl_size = 0;</div><div class="line"> <a name="_a8"></a><a class="code" href="struct_group_rl.html">GroupRl</a>* grp_rl = NULL;</div><div class="line"> <span class="keywordtype">size_t</span> grp_rl_size = 0;</div><div class="line"></div><div class="line"> <span class="keywordflow">do</span> {</div><div class="line"> <a name="_a9"></a><a class="code" href="struct_group_pub_key.html">GroupPubKey</a> pub_key = {0};</div><div class="line"> <span class="comment">// authenticate and extract group public key</span></div><div class="line"> result = <a name="a10"></a><a class="code" href="group___file_parser.html#ga43fdbc1bf2edd3695d21cb457365afbb">EpidParseGroupPubKeyFile</a>(signed_pub_key, signed_pub_key_size,</div><div class="line"> cacert, &amp;pub_key);</div><div class="line"> <span class="keywordflow">if</span> (<a name="a11"></a><a class="code" href="group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360a8a6861e14322ca9193498ffc955537f9">kEpidNoErr</a> != result) {</div><div class="line"> <span class="keywordflow">break</span>;</div><div class="line"> }</div><div class="line"></div><div class="line"> <span class="keywordflow">if</span> (is_precomp_init &amp;&amp; precomp) {</div><div class="line"> <span class="comment">// create verifier</span></div><div class="line"> result = <a name="a12"></a><a class="code" href="group___epid_verifier_module.html#ga1d116daaee5466a1485d26ebc4e3ab70">EpidVerifierCreate</a>(&amp;pub_key, precomp, &amp;ctx);</div><div class="line"> <span class="keywordflow">if</span> (<a class="code" href="group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360a8a6861e14322ca9193498ffc955537f9">kEpidNoErr</a> != result) {</div><div class="line"> <span class="keywordflow">break</span>;</div><div class="line"> }</div><div class="line"> } <span class="keywordflow">else</span> {</div><div class="line"> <span class="comment">// create verifier</span></div><div class="line"> result = <a class="code" href="group___epid_verifier_module.html#ga1d116daaee5466a1485d26ebc4e3ab70">EpidVerifierCreate</a>(&amp;pub_key, NULL, &amp;ctx);</div><div class="line"> <span class="keywordflow">if</span> (<a class="code" href="group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360a8a6861e14322ca9193498ffc955537f9">kEpidNoErr</a> != result) {</div><div class="line"> <span class="keywordflow">break</span>;</div><div class="line"> }</div><div class="line"></div><div class="line"> <span class="comment">// initialize pre-computation blob</span></div><div class="line"> result = <a name="a13"></a><a class="code" href="group___epid_verifier_module.html#ga92df4d00ea4ee59d7bfd35b23da03392">EpidVerifierWritePrecomp</a>(ctx, precomp);</div><div class="line"> <span class="keywordflow">if</span> (<a class="code" href="group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360a8a6861e14322ca9193498ffc955537f9">kEpidNoErr</a> != result) {</div><div class="line"> <span class="keywordflow">break</span>;</div><div class="line"> }</div><div class="line"> }</div><div class="line"></div><div class="line"> <span class="comment">// set hash algorithm used for signing</span></div><div class="line"> result = <a name="a14"></a><a class="code" href="group___epid_verifier_module.html#ga97b58b2382f24756b66a357f1e825c92">EpidVerifierSetHashAlg</a>(ctx, hash_alg);</div><div class="line"> <span class="keywordflow">if</span> (<a class="code" href="group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360a8a6861e14322ca9193498ffc955537f9">kEpidNoErr</a> != result) {</div><div class="line"> <span class="keywordflow">break</span>;</div><div class="line"> }</div><div class="line"></div><div class="line"> <span class="keywordflow">if</span> (signed_priv_rl) {</div><div class="line"> result = AuthenticateAndAllocateRl(signed_priv_rl, signed_priv_rl_size,</div><div class="line"> cacert, <a name="a15"></a><a class="code" href="group___file_parser.html#gga9a33be7edc6b4c7a867fb07bd2bddecba692b4141bff8225bee6000750b0da322">kPrivRlFile</a>, <span class="stringliteral">&quot;PrivRl&quot;</span>,</div><div class="line"> (<span class="keywordtype">void</span>**)&amp;priv_rl, &amp;priv_rl_size);</div><div class="line"> <span class="keywordflow">if</span> (<a class="code" href="group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360a8a6861e14322ca9193498ffc955537f9">kEpidNoErr</a> != result) {</div><div class="line"> <span class="keywordflow">break</span>;</div><div class="line"> }</div><div class="line"> <span class="comment">// set private key based revocation list</span></div><div class="line"> result = <a name="a16"></a><a class="code" href="group___epid_verifier_module.html#gafab08180a43b58ce2e1d56c4b070bb0e">EpidVerifierSetPrivRl</a>(ctx, priv_rl, priv_rl_size);</div><div class="line"> <span class="keywordflow">if</span> (<a class="code" href="group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360a8a6861e14322ca9193498ffc955537f9">kEpidNoErr</a> != result) {</div><div class="line"> <span class="keywordflow">break</span>;</div><div class="line"> }</div><div class="line"> }</div><div class="line"></div><div class="line"> <span class="keywordflow">if</span> (signed_sig_rl) {</div><div class="line"> result = AuthenticateAndAllocateRl(signed_sig_rl, signed_sig_rl_size,</div><div class="line"> cacert, <a name="a17"></a><a class="code" href="group___file_parser.html#gga9a33be7edc6b4c7a867fb07bd2bddecba8aead4b6aab87a1efb2d7e8c77a9b710">kSigRlFile</a>, <span class="stringliteral">&quot;SigRl&quot;</span>,</div><div class="line"> (<span class="keywordtype">void</span>**)&amp;sig_rl, &amp;sig_rl_size);</div><div class="line"> <span class="keywordflow">if</span> (<a class="code" href="group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360a8a6861e14322ca9193498ffc955537f9">kEpidNoErr</a> != result) {</div><div class="line"> <span class="keywordflow">break</span>;</div><div class="line"> }</div><div class="line"> <span class="comment">// set signature based revocation list</span></div><div class="line"> result = <a name="a18"></a><a class="code" href="group___epid_verifier_module.html#ga4c7c9820409ee06f30bb8dc75fdd5dcf">EpidVerifierSetSigRl</a>(ctx, sig_rl, sig_rl_size);</div><div class="line"> <span class="keywordflow">if</span> (<a class="code" href="group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360a8a6861e14322ca9193498ffc955537f9">kEpidNoErr</a> != result) {</div><div class="line"> <span class="keywordflow">break</span>;</div><div class="line"> }</div><div class="line"> }</div><div class="line"></div><div class="line"> <span class="keywordflow">if</span> (signed_grp_rl) {</div><div class="line"> result = AuthenticateAndAllocateRl(signed_grp_rl, signed_grp_rl_size,</div><div class="line"> cacert, <a name="a19"></a><a class="code" href="group___file_parser.html#gga9a33be7edc6b4c7a867fb07bd2bddecba8e5247daee3999540e6cb24d4c2b3770">kGroupRlFile</a>, <span class="stringliteral">&quot;GroupRl&quot;</span>,</div><div class="line"> (<span class="keywordtype">void</span>**)&amp;grp_rl, &amp;grp_rl_size);</div><div class="line"> <span class="keywordflow">if</span> (<a class="code" href="group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360a8a6861e14322ca9193498ffc955537f9">kEpidNoErr</a> != result) {</div><div class="line"> <span class="keywordflow">break</span>;</div><div class="line"> }</div><div class="line"> <span class="comment">// set group based revocation list</span></div><div class="line"> result = <a name="a20"></a><a class="code" href="group___epid_verifier_module.html#ga1d41d6ef4dabbc30ec28452edd6baffb">EpidVerifierSetGroupRl</a>(ctx, grp_rl, grp_rl_size);</div><div class="line"> <span class="keywordflow">if</span> (<a class="code" href="group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360a8a6861e14322ca9193498ffc955537f9">kEpidNoErr</a> != result) {</div><div class="line"> <span class="keywordflow">break</span>;</div><div class="line"> }</div><div class="line"> }</div><div class="line"></div><div class="line"> <span class="keywordflow">if</span> (ver_rl) {</div><div class="line"> <span class="comment">// set verifier based revocation list</span></div><div class="line"> result = <a name="a21"></a><a class="code" href="group___epid_verifier_module.html#ga0909703a0a4dfe080374d0d99077465a">EpidVerifierSetVerifierRl</a>(ctx, ver_rl, ver_rl_size);</div><div class="line"> <span class="keywordflow">if</span> (<a class="code" href="group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360a8a6861e14322ca9193498ffc955537f9">kEpidNoErr</a> != result) {</div><div class="line"> <span class="keywordflow">break</span>;</div><div class="line"> }</div><div class="line"> }</div><div class="line"></div><div class="line"> <span class="comment">// verify signature</span></div><div class="line"> result =</div><div class="line"> <a name="a22"></a><a class="code" href="group___epid_verifier_module.html#ga39b240a17f310894e9f5946c9a731798">EpidVerify</a>(ctx, sig, sig_len, msg, msg_len, basename, basename_len);</div><div class="line"> <span class="keywordflow">if</span> (<a class="code" href="group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360a8a6861e14322ca9193498ffc955537f9">kEpidNoErr</a> != result) {</div><div class="line"> <span class="keywordflow">break</span>;</div><div class="line"> }</div><div class="line"> } <span class="keywordflow">while</span> (0);</div><div class="line"></div><div class="line"> <span class="comment">// delete verifier</span></div><div class="line"> <a name="a23"></a><a class="code" href="group___epid_verifier_module.html#ga6707e691f4b3916f9c684d5bbd463d12">EpidVerifierDelete</a>(&amp;ctx);</div><div class="line"></div><div class="line"> <span class="keywordflow">if</span> (priv_rl) free(priv_rl);</div><div class="line"> <span class="keywordflow">if</span> (sig_rl) free(sig_rl);</div><div class="line"> <span class="keywordflow">if</span> (grp_rl) free(grp_rl);</div><div class="line"></div><div class="line"> <span class="keywordflow">return</span> result;</div><div class="line">}</div><div class="line"></div><div class="line"><a class="code" href="group___error_codes.html#gafdb27c77c2c4b32c807e326a8a0da360">EpidStatus</a> AuthenticateAndAllocateRl(<span class="keywordtype">void</span> <span class="keyword">const</span>* buf, <span class="keywordtype">size_t</span> len,</div><div class="line"> <a class="code" href="struct_epid_ca_certificate.html">EpidCaCertificate</a> <span class="keyword">const</span>* cert,</div><div class="line"> <a class="code" href="group___file_parser.html#ga9a33be7edc6b4c7a867fb07bd2bddecb">EpidFileType</a> file_type, <span class="keyword">const</span> <span class="keywordtype">char</span>* name,</div><div class="line"> <span class="keywordtype">void</span>** new_rl, <span class="keywordtype">size_t</span>* rl_len) {</div><div class="line"> <span class="keyword">typedef</span> <a name="a24"></a><a class="code" href="group___error_codes.html#gafdb27c77c2c4b32c807e326a8a0da360">EpidStatus</a> (*ParseFuncType)(<span class="keywordtype">void</span> <span class="keyword">const</span>* buf, <span class="keywordtype">size_t</span> len,</div><div class="line"> <a class="code" href="struct_epid_ca_certificate.html">EpidCaCertificate</a> <span class="keyword">const</span>* cert,</div><div class="line"> <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span>* rl, <span class="keywordtype">size_t</span>* rl_len);</div><div class="line"> <a class="code" href="group___error_codes.html#gafdb27c77c2c4b32c807e326a8a0da360">EpidStatus</a> result = <a class="code" href="group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360aa08f0d2e394b37694117a6a32bc71e6e">kEpidErr</a>;</div><div class="line"> <span class="keywordtype">void</span>* parsed_rl = NULL;</div><div class="line"> ParseFuncType ParseFunc = NULL;</div><div class="line"></div><div class="line"> <span class="keywordflow">if</span> (!buf || !cert || !new_rl || !rl_len || !name) {</div><div class="line"> <span class="keywordflow">return</span> <a name="a25"></a><a class="code" href="group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360ad134d6cc95a9dcb1b1a9f9c358047cbf">kEpidBadArgErr</a>;</div><div class="line"> }</div><div class="line"></div><div class="line"> <span class="keywordflow">switch</span> (file_type) {</div><div class="line"> <span class="keywordflow">case</span> <a class="code" href="group___file_parser.html#gga9a33be7edc6b4c7a867fb07bd2bddecba692b4141bff8225bee6000750b0da322">kPrivRlFile</a>:</div><div class="line"> ParseFunc = (ParseFuncType)&amp;<a name="a26"></a><a class="code" href="group___file_parser.html#gadc033fb23e3cbda56aa7e3d412060b7e">EpidParsePrivRlFile</a>;</div><div class="line"> <span class="keywordflow">break</span>;</div><div class="line"> <span class="keywordflow">case</span> <a class="code" href="group___file_parser.html#gga9a33be7edc6b4c7a867fb07bd2bddecba8aead4b6aab87a1efb2d7e8c77a9b710">kSigRlFile</a>:</div><div class="line"> ParseFunc = (ParseFuncType)&amp;<a name="a27"></a><a class="code" href="group___file_parser.html#ga237ef5a43076aa6fc6eb18829a93da3f">EpidParseSigRlFile</a>;</div><div class="line"> <span class="keywordflow">break</span>;</div><div class="line"> <span class="keywordflow">case</span> <a class="code" href="group___file_parser.html#gga9a33be7edc6b4c7a867fb07bd2bddecba8e5247daee3999540e6cb24d4c2b3770">kGroupRlFile</a>:</div><div class="line"> ParseFunc = (ParseFuncType)&amp;<a name="a28"></a><a class="code" href="group___file_parser.html#gad767f72dc55307b872a8b5600da3fd6f">EpidParseGroupRlFile</a>;</div><div class="line"> <span class="keywordflow">break</span>;</div><div class="line"> <span class="keywordflow">default</span>:</div><div class="line"> <span class="keywordflow">return</span> <a class="code" href="group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360ad134d6cc95a9dcb1b1a9f9c358047cbf">kEpidBadArgErr</a>;</div><div class="line"> }</div><div class="line"></div><div class="line"> <span class="keywordflow">do</span> {</div><div class="line"> <span class="keywordtype">size_t</span> parsed_len = 0;</div><div class="line"></div><div class="line"> <span class="comment">// authenticate and determine space needed for RL</span></div><div class="line"> result = ParseFunc(buf, len, cert, NULL, &amp;parsed_len);</div><div class="line"> <span class="keywordflow">if</span> (<a name="a29"></a><a class="code" href="group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360aeedd19b8a1cbdecf963f90b4860e02b8">kEpidSigInvalid</a> == result) {</div><div class="line"> <span class="comment">// authentication failure</span></div><div class="line"> <span class="keywordflow">break</span>;</div><div class="line"> }</div><div class="line"> <span class="keywordflow">if</span> (<a class="code" href="group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360a8a6861e14322ca9193498ffc955537f9">kEpidNoErr</a> != result) {</div><div class="line"> <span class="keywordflow">break</span>;</div><div class="line"> }</div><div class="line"> parsed_rl = AllocBuffer(parsed_len);</div><div class="line"> <span class="keywordflow">if</span> (!parsed_rl) {</div><div class="line"> result = <a name="a30"></a><a class="code" href="group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360a11a4d2f1c37064eb663de08dc57bcda8">kEpidMemAllocErr</a>;</div><div class="line"> <span class="keywordflow">break</span>;</div><div class="line"> }</div><div class="line"></div><div class="line"> <span class="comment">// fill the rl</span></div><div class="line"> result = ParseFunc(buf, len, cert, parsed_rl, &amp;parsed_len);</div><div class="line"></div><div class="line"> <span class="keywordflow">if</span> (<a class="code" href="group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360a8a6861e14322ca9193498ffc955537f9">kEpidNoErr</a> != result) {</div><div class="line"> <span class="keywordflow">break</span>;</div><div class="line"> }</div><div class="line"></div><div class="line"> *rl_len = parsed_len;</div><div class="line"> *new_rl = parsed_rl;</div><div class="line"> } <span class="keywordflow">while</span> (0);</div><div class="line"></div><div class="line"> <span class="keywordflow">if</span> (<a class="code" href="group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360a8a6861e14322ca9193498ffc955537f9">kEpidNoErr</a> != result) {</div><div class="line"> <span class="keywordflow">if</span> (parsed_rl) free(parsed_rl);</div><div class="line"> }</div><div class="line"></div><div class="line"> <span class="keywordflow">return</span> result;</div><div class="line">}</div></div><!-- fragment --> </div><!-- contents -->
  66. </div><!-- doc-content -->
  67. <!-- HTML footer for doxygen 1.8.10-->
  68. <!-- start footer part -->
  69. <div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  70. <ul>
  71. <li class="footer">
  72. &copy; 2016 Intel Corporation
  73. </li>
  74. </ul>
  75. </div>
  76. </body>
  77. </html>