Gilles Peskine | 89f0a53 | 2019-01-31 11:47:57 +0100 | [diff] [blame] | 1 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
| 2 | <html xmlns="http://www.w3.org/1999/xhtml"> |
| 3 | <head> |
| 4 | <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> |
| 5 | <meta http-equiv="X-UA-Compatible" content="IE=9"/> |
| 6 | <meta name="generator" content="Doxygen 1.8.11"/> |
| 7 | <title>Platform Security Architecture — cryptography and keystore interface: Message digests</title> |
| 8 | <link href="tabs.css" rel="stylesheet" type="text/css"/> |
| 9 | <script type="text/javascript" src="jquery.js"></script> |
| 10 | <script type="text/javascript" src="dynsections.js"></script> |
| 11 | <link href="search/search.css" rel="stylesheet" type="text/css"/> |
| 12 | <script type="text/javascript" src="search/searchdata.js"></script> |
| 13 | <script type="text/javascript" src="search/search.js"></script> |
| 14 | <script type="text/javascript"> |
| 15 | $(document).ready(function() { init_search(); }); |
| 16 | </script> |
| 17 | <link href="doxygen.css" rel="stylesheet" type="text/css" /> |
| 18 | </head> |
| 19 | <body> |
| 20 | <div id="top"><!-- do not remove this div, it is closed by doxygen! --> |
| 21 | <div id="titlearea"> |
| 22 | <table cellspacing="0" cellpadding="0"> |
| 23 | <tbody> |
| 24 | <tr style="height: 56px;"> |
| 25 | <td id="projectalign" style="padding-left: 0.5em;"> |
| 26 | <div id="projectname">Platform Security Architecture — cryptography and keystore interface |
Gilles Peskine | 45adc5b | 2019-03-05 16:34:20 +0100 | [diff] [blame^] | 27 |  <span id="projectnumber">beta 2 — 2019-02-22</span> |
Gilles Peskine | 89f0a53 | 2019-01-31 11:47:57 +0100 | [diff] [blame] | 28 | </div> |
| 29 | </td> |
| 30 | </tr> |
| 31 | </tbody> |
| 32 | </table> |
| 33 | </div> |
| 34 | <!-- end header part --> |
| 35 | <!-- Generated by Doxygen 1.8.11 --> |
| 36 | <script type="text/javascript"> |
| 37 | var searchBox = new SearchBox("searchBox", "search",false,'Search'); |
| 38 | </script> |
| 39 | <div id="navrow1" class="tabs"> |
| 40 | <ul class="tablist"> |
| 41 | <li><a href="index.html"><span>Main Page</span></a></li> |
| 42 | <li class="current"><a href="modules.html"><span>Modules</span></a></li> |
| 43 | <li><a href="annotated.html"><span>Classes</span></a></li> |
| 44 | <li><a href="files.html"><span>Files</span></a></li> |
| 45 | <li> |
| 46 | <div id="MSearchBox" class="MSearchBoxInactive"> |
| 47 | <span class="left"> |
| 48 | <img id="MSearchSelect" src="search/mag_sel.png" |
| 49 | onmouseover="return searchBox.OnSearchSelectShow()" |
| 50 | onmouseout="return searchBox.OnSearchSelectHide()" |
| 51 | alt=""/> |
| 52 | <input type="text" id="MSearchField" value="Search" accesskey="S" |
| 53 | onfocus="searchBox.OnSearchFieldFocus(true)" |
| 54 | onblur="searchBox.OnSearchFieldFocus(false)" |
| 55 | onkeyup="searchBox.OnSearchFieldChange(event)"/> |
| 56 | </span><span class="right"> |
| 57 | <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a> |
| 58 | </span> |
| 59 | </div> |
| 60 | </li> |
| 61 | </ul> |
| 62 | </div> |
| 63 | </div><!-- top --> |
| 64 | <!-- window showing the filter options --> |
| 65 | <div id="MSearchSelectWindow" |
| 66 | onmouseover="return searchBox.OnSearchSelectShow()" |
| 67 | onmouseout="return searchBox.OnSearchSelectHide()" |
| 68 | onkeydown="return searchBox.OnSearchSelectKey(event)"> |
| 69 | </div> |
| 70 | |
| 71 | <!-- iframe showing the search results (closed by default) --> |
| 72 | <div id="MSearchResultsWindow"> |
| 73 | <iframe src="javascript:void(0)" frameborder="0" |
| 74 | name="MSearchResults" id="MSearchResults"> |
| 75 | </iframe> |
| 76 | </div> |
| 77 | |
| 78 | <div class="header"> |
| 79 | <div class="summary"> |
| 80 | <a href="#define-members">Macros</a> | |
| 81 | <a href="#typedef-members">Typedefs</a> | |
| 82 | <a href="#func-members">Functions</a> </div> |
| 83 | <div class="headertitle"> |
| 84 | <div class="title">Message digests</div> </div> |
| 85 | </div><!--header--> |
| 86 | <div class="contents"> |
| 87 | <table class="memberdecls"> |
| 88 | <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="define-members"></a> |
| 89 | Macros</h2></td></tr> |
| 90 | <tr class="memitem:ga6ab7fe8d3500bc2f21be840b4f4f8d1d"><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="group__hash.html#ga6ab7fe8d3500bc2f21be840b4f4f8d1d">PSA_HASH_OPERATION_INIT</a>   {0}</td></tr> |
| 91 | <tr class="separator:ga6ab7fe8d3500bc2f21be840b4f4f8d1d"><td class="memSeparator" colspan="2"> </td></tr> |
| 92 | </table><table class="memberdecls"> |
| 93 | <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="typedef-members"></a> |
| 94 | Typedefs</h2></td></tr> |
| 95 | <tr class="memitem:ga3c4205d2ce66c4095fc5c78c25273fab"><td class="memItemLeft" align="right" valign="top">typedef struct psa_hash_operation_s </td><td class="memItemRight" valign="bottom"><a class="el" href="group__hash.html#ga3c4205d2ce66c4095fc5c78c25273fab">psa_hash_operation_t</a></td></tr> |
| 96 | <tr class="separator:ga3c4205d2ce66c4095fc5c78c25273fab"><td class="memSeparator" colspan="2"> </td></tr> |
| 97 | </table><table class="memberdecls"> |
| 98 | <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a> |
| 99 | Functions</h2></td></tr> |
| 100 | <tr class="memitem:gac69f7f19d96a56c28cf3799d11b12156"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__error.html#ga05676e70ba5c6a7565aff3c36677c1f9">psa_status_t</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="group__hash.html#gac69f7f19d96a56c28cf3799d11b12156">psa_hash_compute</a> (<a class="el" href="group__crypto__types.html#gac2e4d47f1300d73c2f829a6d99252d69">psa_algorithm_t</a> alg, const uint8_t *input, size_t input_length, uint8_t *hash, size_t hash_size, size_t *hash_length)</td></tr> |
| 101 | <tr class="separator:gac69f7f19d96a56c28cf3799d11b12156"><td class="memSeparator" colspan="2"> </td></tr> |
| 102 | <tr class="memitem:ga0bb6dbd3c310648c3cf7d202413ff0bc"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__error.html#ga05676e70ba5c6a7565aff3c36677c1f9">psa_status_t</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="group__hash.html#ga0bb6dbd3c310648c3cf7d202413ff0bc">psa_hash_compare</a> (<a class="el" href="group__crypto__types.html#gac2e4d47f1300d73c2f829a6d99252d69">psa_algorithm_t</a> alg, const uint8_t *input, size_t input_length, const uint8_t *hash, const size_t hash_length)</td></tr> |
| 103 | <tr class="separator:ga0bb6dbd3c310648c3cf7d202413ff0bc"><td class="memSeparator" colspan="2"> </td></tr> |
| 104 | <tr class="memitem:ga8d72896cf70fc4d514c5c6b978912515"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__error.html#ga05676e70ba5c6a7565aff3c36677c1f9">psa_status_t</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="group__hash.html#ga8d72896cf70fc4d514c5c6b978912515">psa_hash_setup</a> (<a class="el" href="group__hash.html#ga3c4205d2ce66c4095fc5c78c25273fab">psa_hash_operation_t</a> *operation, <a class="el" href="group__crypto__types.html#gac2e4d47f1300d73c2f829a6d99252d69">psa_algorithm_t</a> alg)</td></tr> |
| 105 | <tr class="separator:ga8d72896cf70fc4d514c5c6b978912515"><td class="memSeparator" colspan="2"> </td></tr> |
| 106 | <tr class="memitem:ga65b16ef97d7f650899b7db4b7d1112ff"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__error.html#ga05676e70ba5c6a7565aff3c36677c1f9">psa_status_t</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="group__hash.html#ga65b16ef97d7f650899b7db4b7d1112ff">psa_hash_update</a> (<a class="el" href="group__hash.html#ga3c4205d2ce66c4095fc5c78c25273fab">psa_hash_operation_t</a> *operation, const uint8_t *input, size_t input_length)</td></tr> |
| 107 | <tr class="separator:ga65b16ef97d7f650899b7db4b7d1112ff"><td class="memSeparator" colspan="2"> </td></tr> |
| 108 | <tr class="memitem:ga4795fd06a0067b0adcd92e9627b8c97e"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__error.html#ga05676e70ba5c6a7565aff3c36677c1f9">psa_status_t</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="group__hash.html#ga4795fd06a0067b0adcd92e9627b8c97e">psa_hash_finish</a> (<a class="el" href="group__hash.html#ga3c4205d2ce66c4095fc5c78c25273fab">psa_hash_operation_t</a> *operation, uint8_t *hash, size_t hash_size, size_t *hash_length)</td></tr> |
| 109 | <tr class="separator:ga4795fd06a0067b0adcd92e9627b8c97e"><td class="memSeparator" colspan="2"> </td></tr> |
| 110 | <tr class="memitem:ga7be923c5700c9c70ef77ee9b76d1a5c0"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__error.html#ga05676e70ba5c6a7565aff3c36677c1f9">psa_status_t</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="group__hash.html#ga7be923c5700c9c70ef77ee9b76d1a5c0">psa_hash_verify</a> (<a class="el" href="group__hash.html#ga3c4205d2ce66c4095fc5c78c25273fab">psa_hash_operation_t</a> *operation, const uint8_t *hash, size_t hash_length)</td></tr> |
| 111 | <tr class="separator:ga7be923c5700c9c70ef77ee9b76d1a5c0"><td class="memSeparator" colspan="2"> </td></tr> |
| 112 | <tr class="memitem:gab0b4d5f9912a615559497a467b532928"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__error.html#ga05676e70ba5c6a7565aff3c36677c1f9">psa_status_t</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="group__hash.html#gab0b4d5f9912a615559497a467b532928">psa_hash_abort</a> (<a class="el" href="group__hash.html#ga3c4205d2ce66c4095fc5c78c25273fab">psa_hash_operation_t</a> *operation)</td></tr> |
| 113 | <tr class="separator:gab0b4d5f9912a615559497a467b532928"><td class="memSeparator" colspan="2"> </td></tr> |
| 114 | <tr class="memitem:ga39673348f3302b4646bd780034a5aeda"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__error.html#ga05676e70ba5c6a7565aff3c36677c1f9">psa_status_t</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="group__hash.html#ga39673348f3302b4646bd780034a5aeda">psa_hash_clone</a> (const <a class="el" href="group__hash.html#ga3c4205d2ce66c4095fc5c78c25273fab">psa_hash_operation_t</a> *source_operation, <a class="el" href="group__hash.html#ga3c4205d2ce66c4095fc5c78c25273fab">psa_hash_operation_t</a> *target_operation)</td></tr> |
| 115 | <tr class="separator:ga39673348f3302b4646bd780034a5aeda"><td class="memSeparator" colspan="2"> </td></tr> |
| 116 | </table> |
| 117 | <a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2> |
| 118 | <h2 class="groupheader">Macro Definition Documentation</h2> |
| 119 | <a class="anchor" id="ga6ab7fe8d3500bc2f21be840b4f4f8d1d"></a> |
| 120 | <div class="memitem"> |
| 121 | <div class="memproto"> |
| 122 | <table class="memname"> |
| 123 | <tr> |
| 124 | <td class="memname">#define PSA_HASH_OPERATION_INIT   {0}</td> |
| 125 | </tr> |
| 126 | </table> |
| 127 | </div><div class="memdoc"> |
| 128 | <p>This macro returns a suitable initializer for a hash operation object of type <a class="el" href="group__hash.html#ga3c4205d2ce66c4095fc5c78c25273fab">psa_hash_operation_t</a>. </p> |
| 129 | |
| 130 | </div> |
| 131 | </div> |
| 132 | <h2 class="groupheader">Typedef Documentation</h2> |
| 133 | <a class="anchor" id="ga3c4205d2ce66c4095fc5c78c25273fab"></a> |
| 134 | <div class="memitem"> |
| 135 | <div class="memproto"> |
| 136 | <table class="memname"> |
| 137 | <tr> |
| 138 | <td class="memname">typedef struct psa_hash_operation_s <a class="el" href="group__hash.html#ga3c4205d2ce66c4095fc5c78c25273fab">psa_hash_operation_t</a></td> |
| 139 | </tr> |
| 140 | </table> |
| 141 | </div><div class="memdoc"> |
| 142 | <p>The type of the state data structure for multipart hash operations.</p> |
| 143 | <p>Before calling any function on a hash operation object, the application must initialize it by any of the following means:</p><ul> |
| 144 | <li>Set the structure to all-bits-zero, for example: <div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno"> 1</span> psa_hash_operation_t operation;</div><div class="line"><a name="l00002"></a><span class="lineno"> 2</span> memset(&operation, 0, sizeof(operation));</div></div><!-- fragment --></li> |
| 145 | <li>Initialize the structure to logical zero values, for example: <div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno"> 1</span> psa_hash_operation_t operation = {0};</div></div><!-- fragment --></li> |
| 146 | <li>Initialize the structure to the initializer <a class="el" href="group__hash.html#ga6ab7fe8d3500bc2f21be840b4f4f8d1d">PSA_HASH_OPERATION_INIT</a>, for example: <div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno"> 1</span> psa_hash_operation_t operation = PSA_HASH_OPERATION_INIT;</div></div><!-- fragment --></li> |
| 147 | <li>Assign the result of the function psa_hash_operation_init() to the structure, for example: <div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno"> 1</span> psa_hash_operation_t operation;</div><div class="line"><a name="l00002"></a><span class="lineno"> 2</span> operation = psa_hash_operation_init();</div></div><!-- fragment --></li> |
| 148 | </ul> |
| 149 | <p>This is an implementation-defined <code>struct</code>. Applications should not make any assumptions about the content of this structure except as directed by the documentation of a specific implementation. </p> |
| 150 | |
| 151 | </div> |
| 152 | </div> |
| 153 | <h2 class="groupheader">Function Documentation</h2> |
| 154 | <a class="anchor" id="gab0b4d5f9912a615559497a467b532928"></a> |
| 155 | <div class="memitem"> |
| 156 | <div class="memproto"> |
| 157 | <table class="memname"> |
| 158 | <tr> |
| 159 | <td class="memname"><a class="el" href="group__error.html#ga05676e70ba5c6a7565aff3c36677c1f9">psa_status_t</a> psa_hash_abort </td> |
| 160 | <td>(</td> |
| 161 | <td class="paramtype"><a class="el" href="group__hash.html#ga3c4205d2ce66c4095fc5c78c25273fab">psa_hash_operation_t</a> * </td> |
| 162 | <td class="paramname"><em>operation</em></td><td>)</td> |
| 163 | <td></td> |
| 164 | </tr> |
| 165 | </table> |
| 166 | </div><div class="memdoc"> |
| 167 | <p>Abort a hash operation.</p> |
| 168 | <p>Aborting an operation frees all associated resources except for the <code>operation</code> structure itself. Once aborted, the operation object can be reused for another operation by calling <a class="el" href="group__hash.html#ga8d72896cf70fc4d514c5c6b978912515">psa_hash_setup()</a> again.</p> |
| 169 | <p>You may call this function any time after the operation object has been initialized by any of the following methods:</p><ul> |
| 170 | <li>A call to <a class="el" href="group__hash.html#ga8d72896cf70fc4d514c5c6b978912515">psa_hash_setup()</a>, whether it succeeds or not.</li> |
| 171 | <li>Initializing the <code>struct</code> to all-bits-zero.</li> |
| 172 | <li>Initializing the <code>struct</code> to logical zeros, e.g. <code>psa_hash_operation_t operation = {0}</code>.</li> |
| 173 | </ul> |
| 174 | <p>In particular, calling <a class="el" href="group__hash.html#gab0b4d5f9912a615559497a467b532928">psa_hash_abort()</a> after the operation has been terminated by a call to <a class="el" href="group__hash.html#gab0b4d5f9912a615559497a467b532928">psa_hash_abort()</a>, <a class="el" href="group__hash.html#ga4795fd06a0067b0adcd92e9627b8c97e">psa_hash_finish()</a> or <a class="el" href="group__hash.html#ga7be923c5700c9c70ef77ee9b76d1a5c0">psa_hash_verify()</a> is safe and has no effect.</p> |
| 175 | <dl class="params"><dt>Parameters</dt><dd> |
| 176 | <table class="params"> |
| 177 | <tr><td class="paramdir">[in,out]</td><td class="paramname">operation</td><td>Initialized hash operation.</td></tr> |
| 178 | </table> |
| 179 | </dd> |
| 180 | </dl> |
| 181 | <dl class="retval"><dt>Return values</dt><dd> |
| 182 | <table class="retval"> |
| 183 | <tr><td class="paramname"><a class="el" href="group__error.html#ga4cc859e2c66ca381c7418db3527a65e1">PSA_SUCCESS</a></td><td></td></tr> |
| 184 | <tr><td class="paramname"><a class="el" href="group__error.html#ga933d40fa2a591004f2e93aa91e11db84">PSA_ERROR_BAD_STATE</a></td><td><code>operation</code> is not an active hash operation. </td></tr> |
| 185 | <tr><td class="paramname"><a class="el" href="group__error.html#ga5cdb6948371d49e916106249020ea3f7">PSA_ERROR_COMMUNICATION_FAILURE</a></td><td></td></tr> |
| 186 | <tr><td class="paramname"><a class="el" href="group__error.html#ga08b10e70fa5ff0b05c631d9f8f6b2c6b">PSA_ERROR_HARDWARE_FAILURE</a></td><td></td></tr> |
| 187 | <tr><td class="paramname"><a class="el" href="group__error.html#ga2c5dda1485cb54f2385cb9c1279a7004">PSA_ERROR_TAMPERING_DETECTED</a></td><td></td></tr> |
| 188 | </table> |
| 189 | </dd> |
| 190 | </dl> |
| 191 | |
| 192 | </div> |
| 193 | </div> |
| 194 | <a class="anchor" id="ga39673348f3302b4646bd780034a5aeda"></a> |
| 195 | <div class="memitem"> |
| 196 | <div class="memproto"> |
| 197 | <table class="memname"> |
| 198 | <tr> |
| 199 | <td class="memname"><a class="el" href="group__error.html#ga05676e70ba5c6a7565aff3c36677c1f9">psa_status_t</a> psa_hash_clone </td> |
| 200 | <td>(</td> |
| 201 | <td class="paramtype">const <a class="el" href="group__hash.html#ga3c4205d2ce66c4095fc5c78c25273fab">psa_hash_operation_t</a> * </td> |
| 202 | <td class="paramname"><em>source_operation</em>, </td> |
| 203 | </tr> |
| 204 | <tr> |
| 205 | <td class="paramkey"></td> |
| 206 | <td></td> |
| 207 | <td class="paramtype"><a class="el" href="group__hash.html#ga3c4205d2ce66c4095fc5c78c25273fab">psa_hash_operation_t</a> * </td> |
| 208 | <td class="paramname"><em>target_operation</em> </td> |
| 209 | </tr> |
| 210 | <tr> |
| 211 | <td></td> |
| 212 | <td>)</td> |
| 213 | <td></td><td></td> |
| 214 | </tr> |
| 215 | </table> |
| 216 | </div><div class="memdoc"> |
| 217 | <p>Clone a hash operation.</p> |
| 218 | <p>This function copies the state of an ongoing hash operation to a new operation object. In other words, this function is equivalent to calling <a class="el" href="group__hash.html#ga8d72896cf70fc4d514c5c6b978912515">psa_hash_setup()</a> on <code>target_operation</code> with the same algorithm that <code>source_operation</code> was set up for, then <a class="el" href="group__hash.html#ga65b16ef97d7f650899b7db4b7d1112ff">psa_hash_update()</a> on <code>target_operation</code> with the same input that that was passed to <code>source_operation</code>. After this function returns, the two objects are independent, i.e. subsequent calls involving one of the objects do not affect the other object.</p> |
| 219 | <dl class="params"><dt>Parameters</dt><dd> |
| 220 | <table class="params"> |
| 221 | <tr><td class="paramdir">[in]</td><td class="paramname">source_operation</td><td>The active hash operation to clone. </td></tr> |
| 222 | <tr><td class="paramdir">[in,out]</td><td class="paramname">target_operation</td><td>The operation object to set up. It must be initialized but not active.</td></tr> |
| 223 | </table> |
| 224 | </dd> |
| 225 | </dl> |
| 226 | <dl class="retval"><dt>Return values</dt><dd> |
| 227 | <table class="retval"> |
| 228 | <tr><td class="paramname"><a class="el" href="group__error.html#ga4cc859e2c66ca381c7418db3527a65e1">PSA_SUCCESS</a></td><td></td></tr> |
| 229 | <tr><td class="paramname"><a class="el" href="group__error.html#ga933d40fa2a591004f2e93aa91e11db84">PSA_ERROR_BAD_STATE</a></td><td><code>source_operation</code> is not an active hash operation. </td></tr> |
| 230 | <tr><td class="paramname"><a class="el" href="group__error.html#ga933d40fa2a591004f2e93aa91e11db84">PSA_ERROR_BAD_STATE</a></td><td><code>target_operation</code> is active. </td></tr> |
| 231 | <tr><td class="paramname"><a class="el" href="group__error.html#ga5cdb6948371d49e916106249020ea3f7">PSA_ERROR_COMMUNICATION_FAILURE</a></td><td></td></tr> |
| 232 | <tr><td class="paramname"><a class="el" href="group__error.html#ga08b10e70fa5ff0b05c631d9f8f6b2c6b">PSA_ERROR_HARDWARE_FAILURE</a></td><td></td></tr> |
| 233 | <tr><td class="paramname"><a class="el" href="group__error.html#ga2c5dda1485cb54f2385cb9c1279a7004">PSA_ERROR_TAMPERING_DETECTED</a></td><td></td></tr> |
| 234 | </table> |
| 235 | </dd> |
| 236 | </dl> |
| 237 | |
| 238 | </div> |
| 239 | </div> |
| 240 | <a class="anchor" id="ga0bb6dbd3c310648c3cf7d202413ff0bc"></a> |
| 241 | <div class="memitem"> |
| 242 | <div class="memproto"> |
| 243 | <table class="memname"> |
| 244 | <tr> |
| 245 | <td class="memname"><a class="el" href="group__error.html#ga05676e70ba5c6a7565aff3c36677c1f9">psa_status_t</a> psa_hash_compare </td> |
| 246 | <td>(</td> |
| 247 | <td class="paramtype"><a class="el" href="group__crypto__types.html#gac2e4d47f1300d73c2f829a6d99252d69">psa_algorithm_t</a> </td> |
| 248 | <td class="paramname"><em>alg</em>, </td> |
| 249 | </tr> |
| 250 | <tr> |
| 251 | <td class="paramkey"></td> |
| 252 | <td></td> |
| 253 | <td class="paramtype">const uint8_t * </td> |
| 254 | <td class="paramname"><em>input</em>, </td> |
| 255 | </tr> |
| 256 | <tr> |
| 257 | <td class="paramkey"></td> |
| 258 | <td></td> |
| 259 | <td class="paramtype">size_t </td> |
| 260 | <td class="paramname"><em>input_length</em>, </td> |
| 261 | </tr> |
| 262 | <tr> |
| 263 | <td class="paramkey"></td> |
| 264 | <td></td> |
| 265 | <td class="paramtype">const uint8_t * </td> |
| 266 | <td class="paramname"><em>hash</em>, </td> |
| 267 | </tr> |
| 268 | <tr> |
| 269 | <td class="paramkey"></td> |
| 270 | <td></td> |
| 271 | <td class="paramtype">const size_t </td> |
| 272 | <td class="paramname"><em>hash_length</em> </td> |
| 273 | </tr> |
| 274 | <tr> |
| 275 | <td></td> |
| 276 | <td>)</td> |
| 277 | <td></td><td></td> |
| 278 | </tr> |
| 279 | </table> |
| 280 | </div><div class="memdoc"> |
| 281 | <p>Calculate the hash (digest) of a message and compare it with a reference value.</p> |
| 282 | <dl class="params"><dt>Parameters</dt><dd> |
| 283 | <table class="params"> |
| 284 | <tr><td class="paramdir"></td><td class="paramname">alg</td><td>The hash algorithm to compute (<code>PSA_ALG_XXX</code> value such that <a class="el" href="group__crypto__types.html#gac9280662bb482590b4b33d1dcd32930f">PSA_ALG_IS_HASH</a>(<code>alg</code>) is true). </td></tr> |
| 285 | <tr><td class="paramdir">[in]</td><td class="paramname">input</td><td>Buffer containing the message to hash. </td></tr> |
| 286 | <tr><td class="paramdir"></td><td class="paramname">input_length</td><td>Size of the <code>input</code> buffer in bytes. </td></tr> |
| 287 | <tr><td class="paramdir">[out]</td><td class="paramname">hash</td><td>Buffer containing the expected hash value. </td></tr> |
| 288 | <tr><td class="paramdir"></td><td class="paramname">hash_length</td><td>Size of the <code>hash</code> buffer in bytes.</td></tr> |
| 289 | </table> |
| 290 | </dd> |
| 291 | </dl> |
| 292 | <dl class="retval"><dt>Return values</dt><dd> |
| 293 | <table class="retval"> |
| 294 | <tr><td class="paramname"><a class="el" href="group__error.html#ga4cc859e2c66ca381c7418db3527a65e1">PSA_SUCCESS</a></td><td>The expected hash is identical to the actual hash of the input. </td></tr> |
| 295 | <tr><td class="paramname"><a class="el" href="group__error.html#ga35927f755d232c4766de600f2c49e9f2">PSA_ERROR_INVALID_SIGNATURE</a></td><td>The hash of the message was calculated successfully, but it differs from the expected hash. </td></tr> |
| 296 | <tr><td class="paramname"><a class="el" href="group__error.html#ga1dcc6d130633ed5db8942257581b55dd">PSA_ERROR_NOT_SUPPORTED</a></td><td><code>alg</code> is not supported or is not a hash algorithm. </td></tr> |
| 297 | <tr><td class="paramname"><a class="el" href="group__error.html#ga91b2ad8a867517a2651f1b076c5216e5">PSA_ERROR_INSUFFICIENT_MEMORY</a></td><td></td></tr> |
| 298 | <tr><td class="paramname"><a class="el" href="group__error.html#ga5cdb6948371d49e916106249020ea3f7">PSA_ERROR_COMMUNICATION_FAILURE</a></td><td></td></tr> |
| 299 | <tr><td class="paramname"><a class="el" href="group__error.html#ga08b10e70fa5ff0b05c631d9f8f6b2c6b">PSA_ERROR_HARDWARE_FAILURE</a></td><td></td></tr> |
| 300 | <tr><td class="paramname"><a class="el" href="group__error.html#ga2c5dda1485cb54f2385cb9c1279a7004">PSA_ERROR_TAMPERING_DETECTED</a></td><td></td></tr> |
| 301 | </table> |
| 302 | </dd> |
| 303 | </dl> |
| 304 | |
| 305 | </div> |
| 306 | </div> |
| 307 | <a class="anchor" id="gac69f7f19d96a56c28cf3799d11b12156"></a> |
| 308 | <div class="memitem"> |
| 309 | <div class="memproto"> |
| 310 | <table class="memname"> |
| 311 | <tr> |
| 312 | <td class="memname"><a class="el" href="group__error.html#ga05676e70ba5c6a7565aff3c36677c1f9">psa_status_t</a> psa_hash_compute </td> |
| 313 | <td>(</td> |
| 314 | <td class="paramtype"><a class="el" href="group__crypto__types.html#gac2e4d47f1300d73c2f829a6d99252d69">psa_algorithm_t</a> </td> |
| 315 | <td class="paramname"><em>alg</em>, </td> |
| 316 | </tr> |
| 317 | <tr> |
| 318 | <td class="paramkey"></td> |
| 319 | <td></td> |
| 320 | <td class="paramtype">const uint8_t * </td> |
| 321 | <td class="paramname"><em>input</em>, </td> |
| 322 | </tr> |
| 323 | <tr> |
| 324 | <td class="paramkey"></td> |
| 325 | <td></td> |
| 326 | <td class="paramtype">size_t </td> |
| 327 | <td class="paramname"><em>input_length</em>, </td> |
| 328 | </tr> |
| 329 | <tr> |
| 330 | <td class="paramkey"></td> |
| 331 | <td></td> |
| 332 | <td class="paramtype">uint8_t * </td> |
| 333 | <td class="paramname"><em>hash</em>, </td> |
| 334 | </tr> |
| 335 | <tr> |
| 336 | <td class="paramkey"></td> |
| 337 | <td></td> |
| 338 | <td class="paramtype">size_t </td> |
| 339 | <td class="paramname"><em>hash_size</em>, </td> |
| 340 | </tr> |
| 341 | <tr> |
| 342 | <td class="paramkey"></td> |
| 343 | <td></td> |
| 344 | <td class="paramtype">size_t * </td> |
| 345 | <td class="paramname"><em>hash_length</em> </td> |
| 346 | </tr> |
| 347 | <tr> |
| 348 | <td></td> |
| 349 | <td>)</td> |
| 350 | <td></td><td></td> |
| 351 | </tr> |
| 352 | </table> |
| 353 | </div><div class="memdoc"> |
| 354 | <p>Calculate the hash (digest) of a message.</p> |
| 355 | <dl class="section note"><dt>Note</dt><dd>To verify the hash of a message against an expected value, use <a class="el" href="group__hash.html#ga0bb6dbd3c310648c3cf7d202413ff0bc">psa_hash_compare()</a> instead.</dd></dl> |
| 356 | <dl class="params"><dt>Parameters</dt><dd> |
| 357 | <table class="params"> |
| 358 | <tr><td class="paramdir"></td><td class="paramname">alg</td><td>The hash algorithm to compute (<code>PSA_ALG_XXX</code> value such that <a class="el" href="group__crypto__types.html#gac9280662bb482590b4b33d1dcd32930f">PSA_ALG_IS_HASH</a>(<code>alg</code>) is true). </td></tr> |
| 359 | <tr><td class="paramdir">[in]</td><td class="paramname">input</td><td>Buffer containing the message to hash. </td></tr> |
| 360 | <tr><td class="paramdir"></td><td class="paramname">input_length</td><td>Size of the <code>input</code> buffer in bytes. </td></tr> |
| 361 | <tr><td class="paramdir">[out]</td><td class="paramname">hash</td><td>Buffer where the hash is to be written. </td></tr> |
| 362 | <tr><td class="paramdir"></td><td class="paramname">hash_size</td><td>Size of the <code>hash</code> buffer in bytes. </td></tr> |
Gilles Peskine | 45adc5b | 2019-03-05 16:34:20 +0100 | [diff] [blame^] | 363 | <tr><td class="paramdir">[out]</td><td class="paramname">hash_length</td><td>On success, the number of bytes that make up the hash value. This is always <a class="el" href="crypto__sizes_8h.html#aef340331ce3cba2b57e1fc5624bf1f99">PSA_HASH_SIZE</a>(<code>alg</code>).</td></tr> |
Gilles Peskine | 89f0a53 | 2019-01-31 11:47:57 +0100 | [diff] [blame] | 364 | </table> |
| 365 | </dd> |
| 366 | </dl> |
| 367 | <dl class="retval"><dt>Return values</dt><dd> |
| 368 | <table class="retval"> |
| 369 | <tr><td class="paramname"><a class="el" href="group__error.html#ga4cc859e2c66ca381c7418db3527a65e1">PSA_SUCCESS</a></td><td>Success. </td></tr> |
| 370 | <tr><td class="paramname"><a class="el" href="group__error.html#ga1dcc6d130633ed5db8942257581b55dd">PSA_ERROR_NOT_SUPPORTED</a></td><td><code>alg</code> is not supported or is not a hash algorithm. </td></tr> |
| 371 | <tr><td class="paramname"><a class="el" href="group__error.html#ga91b2ad8a867517a2651f1b076c5216e5">PSA_ERROR_INSUFFICIENT_MEMORY</a></td><td></td></tr> |
| 372 | <tr><td class="paramname"><a class="el" href="group__error.html#ga5cdb6948371d49e916106249020ea3f7">PSA_ERROR_COMMUNICATION_FAILURE</a></td><td></td></tr> |
| 373 | <tr><td class="paramname"><a class="el" href="group__error.html#ga08b10e70fa5ff0b05c631d9f8f6b2c6b">PSA_ERROR_HARDWARE_FAILURE</a></td><td></td></tr> |
| 374 | <tr><td class="paramname"><a class="el" href="group__error.html#ga2c5dda1485cb54f2385cb9c1279a7004">PSA_ERROR_TAMPERING_DETECTED</a></td><td></td></tr> |
| 375 | </table> |
| 376 | </dd> |
| 377 | </dl> |
| 378 | |
| 379 | </div> |
| 380 | </div> |
| 381 | <a class="anchor" id="ga4795fd06a0067b0adcd92e9627b8c97e"></a> |
| 382 | <div class="memitem"> |
| 383 | <div class="memproto"> |
| 384 | <table class="memname"> |
| 385 | <tr> |
| 386 | <td class="memname"><a class="el" href="group__error.html#ga05676e70ba5c6a7565aff3c36677c1f9">psa_status_t</a> psa_hash_finish </td> |
| 387 | <td>(</td> |
| 388 | <td class="paramtype"><a class="el" href="group__hash.html#ga3c4205d2ce66c4095fc5c78c25273fab">psa_hash_operation_t</a> * </td> |
| 389 | <td class="paramname"><em>operation</em>, </td> |
| 390 | </tr> |
| 391 | <tr> |
| 392 | <td class="paramkey"></td> |
| 393 | <td></td> |
| 394 | <td class="paramtype">uint8_t * </td> |
| 395 | <td class="paramname"><em>hash</em>, </td> |
| 396 | </tr> |
| 397 | <tr> |
| 398 | <td class="paramkey"></td> |
| 399 | <td></td> |
| 400 | <td class="paramtype">size_t </td> |
| 401 | <td class="paramname"><em>hash_size</em>, </td> |
| 402 | </tr> |
| 403 | <tr> |
| 404 | <td class="paramkey"></td> |
| 405 | <td></td> |
| 406 | <td class="paramtype">size_t * </td> |
| 407 | <td class="paramname"><em>hash_length</em> </td> |
| 408 | </tr> |
| 409 | <tr> |
| 410 | <td></td> |
| 411 | <td>)</td> |
| 412 | <td></td><td></td> |
| 413 | </tr> |
| 414 | </table> |
| 415 | </div><div class="memdoc"> |
| 416 | <p>Finish the calculation of the hash of a message.</p> |
| 417 | <p>The application must call <a class="el" href="group__hash.html#ga8d72896cf70fc4d514c5c6b978912515">psa_hash_setup()</a> before calling this function. This function calculates the hash of the message formed by concatenating the inputs passed to preceding calls to <a class="el" href="group__hash.html#ga65b16ef97d7f650899b7db4b7d1112ff">psa_hash_update()</a>.</p> |
| 418 | <p>When this function returns, the operation becomes inactive.</p> |
| 419 | <dl class="section warning"><dt>Warning</dt><dd>Applications should not call this function if they expect a specific value for the hash. Call <a class="el" href="group__hash.html#ga7be923c5700c9c70ef77ee9b76d1a5c0">psa_hash_verify()</a> instead. Beware that comparing integrity or authenticity data such as hash values with a function such as <code>memcmp</code> is risky because the time taken by the comparison may leak information about the hashed data which could allow an attacker to guess a valid hash and thereby bypass security controls.</dd></dl> |
| 420 | <dl class="params"><dt>Parameters</dt><dd> |
| 421 | <table class="params"> |
| 422 | <tr><td class="paramdir">[in,out]</td><td class="paramname">operation</td><td>Active hash operation. </td></tr> |
| 423 | <tr><td class="paramdir">[out]</td><td class="paramname">hash</td><td>Buffer where the hash is to be written. </td></tr> |
| 424 | <tr><td class="paramdir"></td><td class="paramname">hash_size</td><td>Size of the <code>hash</code> buffer in bytes. </td></tr> |
| 425 | <tr><td class="paramdir">[out]</td><td class="paramname">hash_length</td><td>On success, the number of bytes that make up the hash value. This is always <a class="el" href="crypto__sizes_8h.html#aef340331ce3cba2b57e1fc5624bf1f99">PSA_HASH_SIZE</a>(<code>alg</code>) where <code>alg</code> is the hash algorithm that is calculated.</td></tr> |
| 426 | </table> |
| 427 | </dd> |
| 428 | </dl> |
| 429 | <dl class="retval"><dt>Return values</dt><dd> |
| 430 | <table class="retval"> |
| 431 | <tr><td class="paramname"><a class="el" href="group__error.html#ga4cc859e2c66ca381c7418db3527a65e1">PSA_SUCCESS</a></td><td>Success. </td></tr> |
| 432 | <tr><td class="paramname"><a class="el" href="group__error.html#ga933d40fa2a591004f2e93aa91e11db84">PSA_ERROR_BAD_STATE</a></td><td>The operation state is not valid (not set up, or already completed). </td></tr> |
| 433 | <tr><td class="paramname"><a class="el" href="group__error.html#ga695025f4ec11249aee7ea3d0f65e01c8">PSA_ERROR_BUFFER_TOO_SMALL</a></td><td>The size of the <code>hash</code> buffer is too small. You can determine a sufficient buffer size by calling <a class="el" href="crypto__sizes_8h.html#aef340331ce3cba2b57e1fc5624bf1f99">PSA_HASH_SIZE</a>(<code>alg</code>) where <code>alg</code> is the hash algorithm that is calculated. </td></tr> |
| 434 | <tr><td class="paramname"><a class="el" href="group__error.html#ga91b2ad8a867517a2651f1b076c5216e5">PSA_ERROR_INSUFFICIENT_MEMORY</a></td><td></td></tr> |
| 435 | <tr><td class="paramname"><a class="el" href="group__error.html#ga5cdb6948371d49e916106249020ea3f7">PSA_ERROR_COMMUNICATION_FAILURE</a></td><td></td></tr> |
| 436 | <tr><td class="paramname"><a class="el" href="group__error.html#ga08b10e70fa5ff0b05c631d9f8f6b2c6b">PSA_ERROR_HARDWARE_FAILURE</a></td><td></td></tr> |
| 437 | <tr><td class="paramname"><a class="el" href="group__error.html#ga2c5dda1485cb54f2385cb9c1279a7004">PSA_ERROR_TAMPERING_DETECTED</a></td><td></td></tr> |
| 438 | </table> |
| 439 | </dd> |
| 440 | </dl> |
| 441 | |
| 442 | </div> |
| 443 | </div> |
| 444 | <a class="anchor" id="ga8d72896cf70fc4d514c5c6b978912515"></a> |
| 445 | <div class="memitem"> |
| 446 | <div class="memproto"> |
| 447 | <table class="memname"> |
| 448 | <tr> |
| 449 | <td class="memname"><a class="el" href="group__error.html#ga05676e70ba5c6a7565aff3c36677c1f9">psa_status_t</a> psa_hash_setup </td> |
| 450 | <td>(</td> |
| 451 | <td class="paramtype"><a class="el" href="group__hash.html#ga3c4205d2ce66c4095fc5c78c25273fab">psa_hash_operation_t</a> * </td> |
| 452 | <td class="paramname"><em>operation</em>, </td> |
| 453 | </tr> |
| 454 | <tr> |
| 455 | <td class="paramkey"></td> |
| 456 | <td></td> |
| 457 | <td class="paramtype"><a class="el" href="group__crypto__types.html#gac2e4d47f1300d73c2f829a6d99252d69">psa_algorithm_t</a> </td> |
| 458 | <td class="paramname"><em>alg</em> </td> |
| 459 | </tr> |
| 460 | <tr> |
| 461 | <td></td> |
| 462 | <td>)</td> |
| 463 | <td></td><td></td> |
| 464 | </tr> |
| 465 | </table> |
| 466 | </div><div class="memdoc"> |
| 467 | <p>Set up a multipart hash operation.</p> |
| 468 | <p>The sequence of operations to calculate a hash (message digest) is as follows:</p><ol type="1"> |
| 469 | <li>Allocate an operation object which will be passed to all the functions listed here.</li> |
| 470 | <li>Initialize the operation object with one of the methods described in the documentation for <a class="el" href="group__hash.html#ga3c4205d2ce66c4095fc5c78c25273fab">psa_hash_operation_t</a>, e.g. PSA_HASH_OPERATION_INIT.</li> |
| 471 | <li>Call <a class="el" href="group__hash.html#ga8d72896cf70fc4d514c5c6b978912515">psa_hash_setup()</a> to specify the algorithm.</li> |
| 472 | <li>Call <a class="el" href="group__hash.html#ga65b16ef97d7f650899b7db4b7d1112ff">psa_hash_update()</a> zero, one or more times, passing a fragment of the message each time. The hash that is calculated is the hash of the concatenation of these messages in order.</li> |
| 473 | <li>To calculate the hash, call <a class="el" href="group__hash.html#ga4795fd06a0067b0adcd92e9627b8c97e">psa_hash_finish()</a>. To compare the hash with an expected value, call <a class="el" href="group__hash.html#ga7be923c5700c9c70ef77ee9b76d1a5c0">psa_hash_verify()</a>.</li> |
| 474 | </ol> |
| 475 | <p>The application may call <a class="el" href="group__hash.html#gab0b4d5f9912a615559497a467b532928">psa_hash_abort()</a> at any time after the operation has been initialized.</p> |
| 476 | <p>After a successful call to <a class="el" href="group__hash.html#ga8d72896cf70fc4d514c5c6b978912515">psa_hash_setup()</a>, the application must eventually terminate the operation. The following events terminate an operation:</p><ul> |
| 477 | <li>A failed call to <a class="el" href="group__hash.html#ga65b16ef97d7f650899b7db4b7d1112ff">psa_hash_update()</a>.</li> |
| 478 | <li>A call to <a class="el" href="group__hash.html#ga4795fd06a0067b0adcd92e9627b8c97e">psa_hash_finish()</a>, <a class="el" href="group__hash.html#ga7be923c5700c9c70ef77ee9b76d1a5c0">psa_hash_verify()</a> or <a class="el" href="group__hash.html#gab0b4d5f9912a615559497a467b532928">psa_hash_abort()</a>.</li> |
| 479 | </ul> |
| 480 | <dl class="params"><dt>Parameters</dt><dd> |
| 481 | <table class="params"> |
| 482 | <tr><td class="paramdir">[in,out]</td><td class="paramname">operation</td><td>The operation object to set up. It must have been initialized as per the documentation for <a class="el" href="group__hash.html#ga3c4205d2ce66c4095fc5c78c25273fab">psa_hash_operation_t</a> and not yet in use. </td></tr> |
| 483 | <tr><td class="paramdir"></td><td class="paramname">alg</td><td>The hash algorithm to compute (<code>PSA_ALG_XXX</code> value such that <a class="el" href="group__crypto__types.html#gac9280662bb482590b4b33d1dcd32930f">PSA_ALG_IS_HASH</a>(<code>alg</code>) is true).</td></tr> |
| 484 | </table> |
| 485 | </dd> |
| 486 | </dl> |
| 487 | <dl class="retval"><dt>Return values</dt><dd> |
| 488 | <table class="retval"> |
| 489 | <tr><td class="paramname"><a class="el" href="group__error.html#ga4cc859e2c66ca381c7418db3527a65e1">PSA_SUCCESS</a></td><td>Success. </td></tr> |
| 490 | <tr><td class="paramname"><a class="el" href="group__error.html#ga1dcc6d130633ed5db8942257581b55dd">PSA_ERROR_NOT_SUPPORTED</a></td><td><code>alg</code> is not supported or is not a hash algorithm. </td></tr> |
| 491 | <tr><td class="paramname"><a class="el" href="group__error.html#ga91b2ad8a867517a2651f1b076c5216e5">PSA_ERROR_INSUFFICIENT_MEMORY</a></td><td></td></tr> |
| 492 | <tr><td class="paramname"><a class="el" href="group__error.html#ga5cdb6948371d49e916106249020ea3f7">PSA_ERROR_COMMUNICATION_FAILURE</a></td><td></td></tr> |
| 493 | <tr><td class="paramname"><a class="el" href="group__error.html#ga08b10e70fa5ff0b05c631d9f8f6b2c6b">PSA_ERROR_HARDWARE_FAILURE</a></td><td></td></tr> |
| 494 | <tr><td class="paramname"><a class="el" href="group__error.html#ga2c5dda1485cb54f2385cb9c1279a7004">PSA_ERROR_TAMPERING_DETECTED</a></td><td></td></tr> |
| 495 | </table> |
| 496 | </dd> |
| 497 | </dl> |
| 498 | |
| 499 | </div> |
| 500 | </div> |
| 501 | <a class="anchor" id="ga65b16ef97d7f650899b7db4b7d1112ff"></a> |
| 502 | <div class="memitem"> |
| 503 | <div class="memproto"> |
| 504 | <table class="memname"> |
| 505 | <tr> |
| 506 | <td class="memname"><a class="el" href="group__error.html#ga05676e70ba5c6a7565aff3c36677c1f9">psa_status_t</a> psa_hash_update </td> |
| 507 | <td>(</td> |
| 508 | <td class="paramtype"><a class="el" href="group__hash.html#ga3c4205d2ce66c4095fc5c78c25273fab">psa_hash_operation_t</a> * </td> |
| 509 | <td class="paramname"><em>operation</em>, </td> |
| 510 | </tr> |
| 511 | <tr> |
| 512 | <td class="paramkey"></td> |
| 513 | <td></td> |
| 514 | <td class="paramtype">const uint8_t * </td> |
| 515 | <td class="paramname"><em>input</em>, </td> |
| 516 | </tr> |
| 517 | <tr> |
| 518 | <td class="paramkey"></td> |
| 519 | <td></td> |
| 520 | <td class="paramtype">size_t </td> |
| 521 | <td class="paramname"><em>input_length</em> </td> |
| 522 | </tr> |
| 523 | <tr> |
| 524 | <td></td> |
| 525 | <td>)</td> |
| 526 | <td></td><td></td> |
| 527 | </tr> |
| 528 | </table> |
| 529 | </div><div class="memdoc"> |
| 530 | <p>Add a message fragment to a multipart hash operation.</p> |
| 531 | <p>The application must call <a class="el" href="group__hash.html#ga8d72896cf70fc4d514c5c6b978912515">psa_hash_setup()</a> before calling this function.</p> |
| 532 | <p>If this function returns an error status, the operation becomes inactive.</p> |
| 533 | <dl class="params"><dt>Parameters</dt><dd> |
| 534 | <table class="params"> |
| 535 | <tr><td class="paramdir">[in,out]</td><td class="paramname">operation</td><td>Active hash operation. </td></tr> |
| 536 | <tr><td class="paramdir">[in]</td><td class="paramname">input</td><td>Buffer containing the message fragment to hash. </td></tr> |
| 537 | <tr><td class="paramdir"></td><td class="paramname">input_length</td><td>Size of the <code>input</code> buffer in bytes.</td></tr> |
| 538 | </table> |
| 539 | </dd> |
| 540 | </dl> |
| 541 | <dl class="retval"><dt>Return values</dt><dd> |
| 542 | <table class="retval"> |
| 543 | <tr><td class="paramname"><a class="el" href="group__error.html#ga4cc859e2c66ca381c7418db3527a65e1">PSA_SUCCESS</a></td><td>Success. </td></tr> |
| 544 | <tr><td class="paramname"><a class="el" href="group__error.html#ga933d40fa2a591004f2e93aa91e11db84">PSA_ERROR_BAD_STATE</a></td><td>The operation state is not valid (not set up, or already completed). </td></tr> |
| 545 | <tr><td class="paramname"><a class="el" href="group__error.html#ga91b2ad8a867517a2651f1b076c5216e5">PSA_ERROR_INSUFFICIENT_MEMORY</a></td><td></td></tr> |
| 546 | <tr><td class="paramname"><a class="el" href="group__error.html#ga5cdb6948371d49e916106249020ea3f7">PSA_ERROR_COMMUNICATION_FAILURE</a></td><td></td></tr> |
| 547 | <tr><td class="paramname"><a class="el" href="group__error.html#ga08b10e70fa5ff0b05c631d9f8f6b2c6b">PSA_ERROR_HARDWARE_FAILURE</a></td><td></td></tr> |
| 548 | <tr><td class="paramname"><a class="el" href="group__error.html#ga2c5dda1485cb54f2385cb9c1279a7004">PSA_ERROR_TAMPERING_DETECTED</a></td><td></td></tr> |
| 549 | </table> |
| 550 | </dd> |
| 551 | </dl> |
| 552 | |
| 553 | </div> |
| 554 | </div> |
| 555 | <a class="anchor" id="ga7be923c5700c9c70ef77ee9b76d1a5c0"></a> |
| 556 | <div class="memitem"> |
| 557 | <div class="memproto"> |
| 558 | <table class="memname"> |
| 559 | <tr> |
| 560 | <td class="memname"><a class="el" href="group__error.html#ga05676e70ba5c6a7565aff3c36677c1f9">psa_status_t</a> psa_hash_verify </td> |
| 561 | <td>(</td> |
| 562 | <td class="paramtype"><a class="el" href="group__hash.html#ga3c4205d2ce66c4095fc5c78c25273fab">psa_hash_operation_t</a> * </td> |
| 563 | <td class="paramname"><em>operation</em>, </td> |
| 564 | </tr> |
| 565 | <tr> |
| 566 | <td class="paramkey"></td> |
| 567 | <td></td> |
| 568 | <td class="paramtype">const uint8_t * </td> |
| 569 | <td class="paramname"><em>hash</em>, </td> |
| 570 | </tr> |
| 571 | <tr> |
| 572 | <td class="paramkey"></td> |
| 573 | <td></td> |
| 574 | <td class="paramtype">size_t </td> |
| 575 | <td class="paramname"><em>hash_length</em> </td> |
| 576 | </tr> |
| 577 | <tr> |
| 578 | <td></td> |
| 579 | <td>)</td> |
| 580 | <td></td><td></td> |
| 581 | </tr> |
| 582 | </table> |
| 583 | </div><div class="memdoc"> |
| 584 | <p>Finish the calculation of the hash of a message and compare it with an expected value.</p> |
| 585 | <p>The application must call <a class="el" href="group__hash.html#ga8d72896cf70fc4d514c5c6b978912515">psa_hash_setup()</a> before calling this function. This function calculates the hash of the message formed by concatenating the inputs passed to preceding calls to <a class="el" href="group__hash.html#ga65b16ef97d7f650899b7db4b7d1112ff">psa_hash_update()</a>. It then compares the calculated hash with the expected hash passed as a parameter to this function.</p> |
| 586 | <p>When this function returns, the operation becomes inactive.</p> |
| 587 | <dl class="section note"><dt>Note</dt><dd>Implementations shall make the best effort to ensure that the comparison between the actual hash and the expected hash is performed in constant time.</dd></dl> |
| 588 | <dl class="params"><dt>Parameters</dt><dd> |
| 589 | <table class="params"> |
| 590 | <tr><td class="paramdir">[in,out]</td><td class="paramname">operation</td><td>Active hash operation. </td></tr> |
| 591 | <tr><td class="paramdir">[in]</td><td class="paramname">hash</td><td>Buffer containing the expected hash value. </td></tr> |
| 592 | <tr><td class="paramdir"></td><td class="paramname">hash_length</td><td>Size of the <code>hash</code> buffer in bytes.</td></tr> |
| 593 | </table> |
| 594 | </dd> |
| 595 | </dl> |
| 596 | <dl class="retval"><dt>Return values</dt><dd> |
| 597 | <table class="retval"> |
| 598 | <tr><td class="paramname"><a class="el" href="group__error.html#ga4cc859e2c66ca381c7418db3527a65e1">PSA_SUCCESS</a></td><td>The expected hash is identical to the actual hash of the message. </td></tr> |
| 599 | <tr><td class="paramname"><a class="el" href="group__error.html#ga35927f755d232c4766de600f2c49e9f2">PSA_ERROR_INVALID_SIGNATURE</a></td><td>The hash of the message was calculated successfully, but it differs from the expected hash. </td></tr> |
| 600 | <tr><td class="paramname"><a class="el" href="group__error.html#ga933d40fa2a591004f2e93aa91e11db84">PSA_ERROR_BAD_STATE</a></td><td>The operation state is not valid (not set up, or already completed). </td></tr> |
| 601 | <tr><td class="paramname"><a class="el" href="group__error.html#ga91b2ad8a867517a2651f1b076c5216e5">PSA_ERROR_INSUFFICIENT_MEMORY</a></td><td></td></tr> |
| 602 | <tr><td class="paramname"><a class="el" href="group__error.html#ga5cdb6948371d49e916106249020ea3f7">PSA_ERROR_COMMUNICATION_FAILURE</a></td><td></td></tr> |
| 603 | <tr><td class="paramname"><a class="el" href="group__error.html#ga08b10e70fa5ff0b05c631d9f8f6b2c6b">PSA_ERROR_HARDWARE_FAILURE</a></td><td></td></tr> |
| 604 | <tr><td class="paramname"><a class="el" href="group__error.html#ga2c5dda1485cb54f2385cb9c1279a7004">PSA_ERROR_TAMPERING_DETECTED</a></td><td></td></tr> |
| 605 | </table> |
| 606 | </dd> |
| 607 | </dl> |
| 608 | |
| 609 | </div> |
| 610 | </div> |
| 611 | </div><!-- contents --> |
| 612 | <!-- start footer part --> |
| 613 | <hr class="footer"/><address class="footer"><small> |
| 614 | Generated by  <a href="http://www.doxygen.org/index.html"> |
| 615 | <img class="footer" src="doxygen.png" alt="doxygen"/> |
| 616 | </a> 1.8.11 |
| 617 | </small></address> |
| 618 | </body> |
| 619 | </html> |