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: Asymmetric cryptography</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="#func-members">Functions</a> </div> |
| 81 | <div class="headertitle"> |
| 82 | <div class="title">Asymmetric cryptography</div> </div> |
| 83 | </div><!--header--> |
| 84 | <div class="contents"> |
| 85 | <table class="memberdecls"> |
| 86 | <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a> |
| 87 | Functions</h2></td></tr> |
| 88 | <tr class="memitem:ga1b0db9d345b5048cdd39357ac2d56c07"><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__asymmetric.html#ga1b0db9d345b5048cdd39357ac2d56c07">psa_asymmetric_sign</a> (<a class="el" href="group__platform.html#gabf6d5fd4e2ea89ecd425c88f057e7f75">psa_key_handle_t</a> handle, <a class="el" href="group__crypto__types.html#gac2e4d47f1300d73c2f829a6d99252d69">psa_algorithm_t</a> alg, const uint8_t *hash, size_t hash_length, uint8_t *signature, size_t signature_size, size_t *signature_length)</td></tr> |
| 89 | <tr class="memdesc:ga1b0db9d345b5048cdd39357ac2d56c07"><td class="mdescLeft"> </td><td class="mdescRight">Sign a hash or short message with a private key. <a href="#ga1b0db9d345b5048cdd39357ac2d56c07">More...</a><br /></td></tr> |
| 90 | <tr class="separator:ga1b0db9d345b5048cdd39357ac2d56c07"><td class="memSeparator" colspan="2"> </td></tr> |
| 91 | <tr class="memitem:ga1b8e964c8d927e3d632325d762959eb7"><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__asymmetric.html#ga1b8e964c8d927e3d632325d762959eb7">psa_asymmetric_verify</a> (<a class="el" href="group__platform.html#gabf6d5fd4e2ea89ecd425c88f057e7f75">psa_key_handle_t</a> handle, <a class="el" href="group__crypto__types.html#gac2e4d47f1300d73c2f829a6d99252d69">psa_algorithm_t</a> alg, const uint8_t *hash, size_t hash_length, const uint8_t *signature, size_t signature_length)</td></tr> |
| 92 | <tr class="memdesc:ga1b8e964c8d927e3d632325d762959eb7"><td class="mdescLeft"> </td><td class="mdescRight">Verify the signature a hash or short message using a public key. <a href="#ga1b8e964c8d927e3d632325d762959eb7">More...</a><br /></td></tr> |
| 93 | <tr class="separator:ga1b8e964c8d927e3d632325d762959eb7"><td class="memSeparator" colspan="2"> </td></tr> |
| 94 | <tr class="memitem:gad429293b7b0bf2a830b9540a02552004"><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__asymmetric.html#gad429293b7b0bf2a830b9540a02552004">psa_asymmetric_encrypt</a> (<a class="el" href="group__platform.html#gabf6d5fd4e2ea89ecd425c88f057e7f75">psa_key_handle_t</a> handle, <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 *salt, size_t salt_length, uint8_t *output, size_t output_size, size_t *output_length)</td></tr> |
| 95 | <tr class="memdesc:gad429293b7b0bf2a830b9540a02552004"><td class="mdescLeft"> </td><td class="mdescRight">Encrypt a short message with a public key. <a href="#gad429293b7b0bf2a830b9540a02552004">More...</a><br /></td></tr> |
| 96 | <tr class="separator:gad429293b7b0bf2a830b9540a02552004"><td class="memSeparator" colspan="2"> </td></tr> |
| 97 | <tr class="memitem:ga34b55fbaee23dba1a677186fc66a556e"><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__asymmetric.html#ga34b55fbaee23dba1a677186fc66a556e">psa_asymmetric_decrypt</a> (<a class="el" href="group__platform.html#gabf6d5fd4e2ea89ecd425c88f057e7f75">psa_key_handle_t</a> handle, <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 *salt, size_t salt_length, uint8_t *output, size_t output_size, size_t *output_length)</td></tr> |
| 98 | <tr class="memdesc:ga34b55fbaee23dba1a677186fc66a556e"><td class="mdescLeft"> </td><td class="mdescRight">Decrypt a short message with a private key. <a href="#ga34b55fbaee23dba1a677186fc66a556e">More...</a><br /></td></tr> |
| 99 | <tr class="separator:ga34b55fbaee23dba1a677186fc66a556e"><td class="memSeparator" colspan="2"> </td></tr> |
| 100 | </table> |
| 101 | <a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2> |
| 102 | <h2 class="groupheader">Function Documentation</h2> |
| 103 | <a class="anchor" id="ga34b55fbaee23dba1a677186fc66a556e"></a> |
| 104 | <div class="memitem"> |
| 105 | <div class="memproto"> |
| 106 | <table class="memname"> |
| 107 | <tr> |
| 108 | <td class="memname"><a class="el" href="group__error.html#ga05676e70ba5c6a7565aff3c36677c1f9">psa_status_t</a> psa_asymmetric_decrypt </td> |
| 109 | <td>(</td> |
| 110 | <td class="paramtype"><a class="el" href="group__platform.html#gabf6d5fd4e2ea89ecd425c88f057e7f75">psa_key_handle_t</a> </td> |
| 111 | <td class="paramname"><em>handle</em>, </td> |
| 112 | </tr> |
| 113 | <tr> |
| 114 | <td class="paramkey"></td> |
| 115 | <td></td> |
| 116 | <td class="paramtype"><a class="el" href="group__crypto__types.html#gac2e4d47f1300d73c2f829a6d99252d69">psa_algorithm_t</a> </td> |
| 117 | <td class="paramname"><em>alg</em>, </td> |
| 118 | </tr> |
| 119 | <tr> |
| 120 | <td class="paramkey"></td> |
| 121 | <td></td> |
| 122 | <td class="paramtype">const uint8_t * </td> |
| 123 | <td class="paramname"><em>input</em>, </td> |
| 124 | </tr> |
| 125 | <tr> |
| 126 | <td class="paramkey"></td> |
| 127 | <td></td> |
| 128 | <td class="paramtype">size_t </td> |
| 129 | <td class="paramname"><em>input_length</em>, </td> |
| 130 | </tr> |
| 131 | <tr> |
| 132 | <td class="paramkey"></td> |
| 133 | <td></td> |
| 134 | <td class="paramtype">const uint8_t * </td> |
| 135 | <td class="paramname"><em>salt</em>, </td> |
| 136 | </tr> |
| 137 | <tr> |
| 138 | <td class="paramkey"></td> |
| 139 | <td></td> |
| 140 | <td class="paramtype">size_t </td> |
| 141 | <td class="paramname"><em>salt_length</em>, </td> |
| 142 | </tr> |
| 143 | <tr> |
| 144 | <td class="paramkey"></td> |
| 145 | <td></td> |
| 146 | <td class="paramtype">uint8_t * </td> |
| 147 | <td class="paramname"><em>output</em>, </td> |
| 148 | </tr> |
| 149 | <tr> |
| 150 | <td class="paramkey"></td> |
| 151 | <td></td> |
| 152 | <td class="paramtype">size_t </td> |
| 153 | <td class="paramname"><em>output_size</em>, </td> |
| 154 | </tr> |
| 155 | <tr> |
| 156 | <td class="paramkey"></td> |
| 157 | <td></td> |
| 158 | <td class="paramtype">size_t * </td> |
| 159 | <td class="paramname"><em>output_length</em> </td> |
| 160 | </tr> |
| 161 | <tr> |
| 162 | <td></td> |
| 163 | <td>)</td> |
| 164 | <td></td><td></td> |
| 165 | </tr> |
| 166 | </table> |
| 167 | </div><div class="memdoc"> |
| 168 | |
| 169 | <p>Decrypt a short message with a private key. </p> |
| 170 | <dl class="params"><dt>Parameters</dt><dd> |
| 171 | <table class="params"> |
| 172 | <tr><td class="paramdir"></td><td class="paramname">handle</td><td>Handle to the key to use for the operation. It must be an asymmetric key pair. </td></tr> |
| 173 | <tr><td class="paramdir"></td><td class="paramname">alg</td><td>An asymmetric encryption algorithm that is compatible with the type of <code>key</code>. </td></tr> |
| 174 | <tr><td class="paramdir">[in]</td><td class="paramname">input</td><td>The message to decrypt. </td></tr> |
| 175 | <tr><td class="paramdir"></td><td class="paramname">input_length</td><td>Size of the <code>input</code> buffer in bytes. </td></tr> |
| 176 | <tr><td class="paramdir">[in]</td><td class="paramname">salt</td><td>A salt or label, if supported by the encryption algorithm. If the algorithm does not support a salt, pass <code>NULL</code>. If the algorithm supports an optional salt and you do not want to pass a salt, pass <code>NULL</code>.</td></tr> |
| 177 | </table> |
| 178 | </dd> |
| 179 | </dl> |
| 180 | <ul> |
| 181 | <li>For <a class="el" href="group__crypto__types.html#ga4c540d3abe43fb9abcb94f2bc51acef9">PSA_ALG_RSA_PKCS1V15_CRYPT</a>, no salt is supported. <dl class="params"><dt>Parameters</dt><dd> |
| 182 | <table class="params"> |
| 183 | <tr><td class="paramdir"></td><td class="paramname">salt_length</td><td>Size of the <code>salt</code> buffer in bytes. If <code>salt</code> is <code>NULL</code>, pass 0. </td></tr> |
| 184 | <tr><td class="paramdir">[out]</td><td class="paramname">output</td><td>Buffer where the decrypted message is to be written. </td></tr> |
| 185 | <tr><td class="paramdir"></td><td class="paramname">output_size</td><td>Size of the <code>output</code> buffer in bytes. </td></tr> |
| 186 | <tr><td class="paramdir">[out]</td><td class="paramname">output_length</td><td>On success, the number of bytes that make up the returned output.</td></tr> |
| 187 | </table> |
| 188 | </dd> |
| 189 | </dl> |
| 190 | <dl class="retval"><dt>Return values</dt><dd> |
| 191 | <table class="retval"> |
| 192 | <tr><td class="paramname"><a class="el" href="group__error.html#ga4cc859e2c66ca381c7418db3527a65e1">PSA_SUCCESS</a></td><td></td></tr> |
| 193 | <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>output</code> buffer is too small. You can determine a sufficient buffer size by calling <a class="el" href="crypto__sizes_8h.html#a61a246f3eac41989821d982e56fea6c1">PSA_ASYMMETRIC_DECRYPT_OUTPUT_SIZE</a>(<code>key_type</code>, <code>key_bits</code>, <code>alg</code>) where <code>key_type</code> and <code>key_bits</code> are the type and bit-size respectively of <code>key</code>. </td></tr> |
| 194 | <tr><td class="paramname"><a class="el" href="group__error.html#ga1dcc6d130633ed5db8942257581b55dd">PSA_ERROR_NOT_SUPPORTED</a></td><td></td></tr> |
| 195 | <tr><td class="paramname"><a class="el" href="group__error.html#ga798df25a505ebf931f7bec1f80f1f85f">PSA_ERROR_INVALID_ARGUMENT</a></td><td></td></tr> |
| 196 | <tr><td class="paramname"><a class="el" href="group__error.html#ga91b2ad8a867517a2651f1b076c5216e5">PSA_ERROR_INSUFFICIENT_MEMORY</a></td><td></td></tr> |
| 197 | <tr><td class="paramname"><a class="el" href="group__error.html#ga5cdb6948371d49e916106249020ea3f7">PSA_ERROR_COMMUNICATION_FAILURE</a></td><td></td></tr> |
| 198 | <tr><td class="paramname"><a class="el" href="group__error.html#ga08b10e70fa5ff0b05c631d9f8f6b2c6b">PSA_ERROR_HARDWARE_FAILURE</a></td><td></td></tr> |
| 199 | <tr><td class="paramname"><a class="el" href="group__error.html#ga2c5dda1485cb54f2385cb9c1279a7004">PSA_ERROR_TAMPERING_DETECTED</a></td><td></td></tr> |
| 200 | <tr><td class="paramname"><a class="el" href="group__error.html#ga4deb59fec02297ec5d8b42178323f675">PSA_ERROR_INSUFFICIENT_ENTROPY</a></td><td></td></tr> |
| 201 | <tr><td class="paramname"><a class="el" href="group__error.html#gabe29594edbfb152cf153975b0597ac48">PSA_ERROR_INVALID_PADDING</a></td><td></td></tr> |
| 202 | <tr><td class="paramname"><a class="el" href="group__error.html#ga933d40fa2a591004f2e93aa91e11db84">PSA_ERROR_BAD_STATE</a></td><td>The library has not been previously initialized by <a class="el" href="group__initialization.html#ga2de150803fc2f7dc6101d5af7e921dd9" title="Library initialization. ">psa_crypto_init()</a>. It is implementation-dependent whether a failure to initialize results in this error code. </td></tr> |
| 203 | </table> |
| 204 | </dd> |
| 205 | </dl> |
| 206 | </li> |
| 207 | </ul> |
| 208 | |
| 209 | </div> |
| 210 | </div> |
| 211 | <a class="anchor" id="gad429293b7b0bf2a830b9540a02552004"></a> |
| 212 | <div class="memitem"> |
| 213 | <div class="memproto"> |
| 214 | <table class="memname"> |
| 215 | <tr> |
| 216 | <td class="memname"><a class="el" href="group__error.html#ga05676e70ba5c6a7565aff3c36677c1f9">psa_status_t</a> psa_asymmetric_encrypt </td> |
| 217 | <td>(</td> |
| 218 | <td class="paramtype"><a class="el" href="group__platform.html#gabf6d5fd4e2ea89ecd425c88f057e7f75">psa_key_handle_t</a> </td> |
| 219 | <td class="paramname"><em>handle</em>, </td> |
| 220 | </tr> |
| 221 | <tr> |
| 222 | <td class="paramkey"></td> |
| 223 | <td></td> |
| 224 | <td class="paramtype"><a class="el" href="group__crypto__types.html#gac2e4d47f1300d73c2f829a6d99252d69">psa_algorithm_t</a> </td> |
| 225 | <td class="paramname"><em>alg</em>, </td> |
| 226 | </tr> |
| 227 | <tr> |
| 228 | <td class="paramkey"></td> |
| 229 | <td></td> |
| 230 | <td class="paramtype">const uint8_t * </td> |
| 231 | <td class="paramname"><em>input</em>, </td> |
| 232 | </tr> |
| 233 | <tr> |
| 234 | <td class="paramkey"></td> |
| 235 | <td></td> |
| 236 | <td class="paramtype">size_t </td> |
| 237 | <td class="paramname"><em>input_length</em>, </td> |
| 238 | </tr> |
| 239 | <tr> |
| 240 | <td class="paramkey"></td> |
| 241 | <td></td> |
| 242 | <td class="paramtype">const uint8_t * </td> |
| 243 | <td class="paramname"><em>salt</em>, </td> |
| 244 | </tr> |
| 245 | <tr> |
| 246 | <td class="paramkey"></td> |
| 247 | <td></td> |
| 248 | <td class="paramtype">size_t </td> |
| 249 | <td class="paramname"><em>salt_length</em>, </td> |
| 250 | </tr> |
| 251 | <tr> |
| 252 | <td class="paramkey"></td> |
| 253 | <td></td> |
| 254 | <td class="paramtype">uint8_t * </td> |
| 255 | <td class="paramname"><em>output</em>, </td> |
| 256 | </tr> |
| 257 | <tr> |
| 258 | <td class="paramkey"></td> |
| 259 | <td></td> |
| 260 | <td class="paramtype">size_t </td> |
| 261 | <td class="paramname"><em>output_size</em>, </td> |
| 262 | </tr> |
| 263 | <tr> |
| 264 | <td class="paramkey"></td> |
| 265 | <td></td> |
| 266 | <td class="paramtype">size_t * </td> |
| 267 | <td class="paramname"><em>output_length</em> </td> |
| 268 | </tr> |
| 269 | <tr> |
| 270 | <td></td> |
| 271 | <td>)</td> |
| 272 | <td></td><td></td> |
| 273 | </tr> |
| 274 | </table> |
| 275 | </div><div class="memdoc"> |
| 276 | |
| 277 | <p>Encrypt a short message with a public key. </p> |
| 278 | <dl class="params"><dt>Parameters</dt><dd> |
| 279 | <table class="params"> |
| 280 | <tr><td class="paramdir"></td><td class="paramname">handle</td><td>Handle to the key to use for the operation. It must be a public key or an asymmetric key pair. </td></tr> |
| 281 | <tr><td class="paramdir"></td><td class="paramname">alg</td><td>An asymmetric encryption algorithm that is compatible with the type of <code>key</code>. </td></tr> |
| 282 | <tr><td class="paramdir">[in]</td><td class="paramname">input</td><td>The message to encrypt. </td></tr> |
| 283 | <tr><td class="paramdir"></td><td class="paramname">input_length</td><td>Size of the <code>input</code> buffer in bytes. </td></tr> |
| 284 | <tr><td class="paramdir">[in]</td><td class="paramname">salt</td><td>A salt or label, if supported by the encryption algorithm. If the algorithm does not support a salt, pass <code>NULL</code>. If the algorithm supports an optional salt and you do not want to pass a salt, pass <code>NULL</code>.</td></tr> |
| 285 | </table> |
| 286 | </dd> |
| 287 | </dl> |
| 288 | <ul> |
| 289 | <li>For <a class="el" href="group__crypto__types.html#ga4c540d3abe43fb9abcb94f2bc51acef9">PSA_ALG_RSA_PKCS1V15_CRYPT</a>, no salt is supported. <dl class="params"><dt>Parameters</dt><dd> |
| 290 | <table class="params"> |
| 291 | <tr><td class="paramdir"></td><td class="paramname">salt_length</td><td>Size of the <code>salt</code> buffer in bytes. If <code>salt</code> is <code>NULL</code>, pass 0. </td></tr> |
| 292 | <tr><td class="paramdir">[out]</td><td class="paramname">output</td><td>Buffer where the encrypted message is to be written. </td></tr> |
| 293 | <tr><td class="paramdir"></td><td class="paramname">output_size</td><td>Size of the <code>output</code> buffer in bytes. </td></tr> |
| 294 | <tr><td class="paramdir">[out]</td><td class="paramname">output_length</td><td>On success, the number of bytes that make up the returned output.</td></tr> |
| 295 | </table> |
| 296 | </dd> |
| 297 | </dl> |
| 298 | <dl class="retval"><dt>Return values</dt><dd> |
| 299 | <table class="retval"> |
| 300 | <tr><td class="paramname"><a class="el" href="group__error.html#ga4cc859e2c66ca381c7418db3527a65e1">PSA_SUCCESS</a></td><td></td></tr> |
| 301 | <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>output</code> buffer is too small. You can determine a sufficient buffer size by calling <a class="el" href="crypto__sizes_8h.html#a66ba3bd93e5ec52870ccc3848778bad8">PSA_ASYMMETRIC_ENCRYPT_OUTPUT_SIZE</a>(<code>key_type</code>, <code>key_bits</code>, <code>alg</code>) where <code>key_type</code> and <code>key_bits</code> are the type and bit-size respectively of <code>key</code>. </td></tr> |
| 302 | <tr><td class="paramname"><a class="el" href="group__error.html#ga1dcc6d130633ed5db8942257581b55dd">PSA_ERROR_NOT_SUPPORTED</a></td><td></td></tr> |
| 303 | <tr><td class="paramname"><a class="el" href="group__error.html#ga798df25a505ebf931f7bec1f80f1f85f">PSA_ERROR_INVALID_ARGUMENT</a></td><td></td></tr> |
| 304 | <tr><td class="paramname"><a class="el" href="group__error.html#ga91b2ad8a867517a2651f1b076c5216e5">PSA_ERROR_INSUFFICIENT_MEMORY</a></td><td></td></tr> |
| 305 | <tr><td class="paramname"><a class="el" href="group__error.html#ga5cdb6948371d49e916106249020ea3f7">PSA_ERROR_COMMUNICATION_FAILURE</a></td><td></td></tr> |
| 306 | <tr><td class="paramname"><a class="el" href="group__error.html#ga08b10e70fa5ff0b05c631d9f8f6b2c6b">PSA_ERROR_HARDWARE_FAILURE</a></td><td></td></tr> |
| 307 | <tr><td class="paramname"><a class="el" href="group__error.html#ga2c5dda1485cb54f2385cb9c1279a7004">PSA_ERROR_TAMPERING_DETECTED</a></td><td></td></tr> |
| 308 | <tr><td class="paramname"><a class="el" href="group__error.html#ga4deb59fec02297ec5d8b42178323f675">PSA_ERROR_INSUFFICIENT_ENTROPY</a></td><td></td></tr> |
| 309 | <tr><td class="paramname"><a class="el" href="group__error.html#ga933d40fa2a591004f2e93aa91e11db84">PSA_ERROR_BAD_STATE</a></td><td>The library has not been previously initialized by <a class="el" href="group__initialization.html#ga2de150803fc2f7dc6101d5af7e921dd9" title="Library initialization. ">psa_crypto_init()</a>. It is implementation-dependent whether a failure to initialize results in this error code. </td></tr> |
| 310 | </table> |
| 311 | </dd> |
| 312 | </dl> |
| 313 | </li> |
| 314 | </ul> |
| 315 | |
| 316 | </div> |
| 317 | </div> |
| 318 | <a class="anchor" id="ga1b0db9d345b5048cdd39357ac2d56c07"></a> |
| 319 | <div class="memitem"> |
| 320 | <div class="memproto"> |
| 321 | <table class="memname"> |
| 322 | <tr> |
| 323 | <td class="memname"><a class="el" href="group__error.html#ga05676e70ba5c6a7565aff3c36677c1f9">psa_status_t</a> psa_asymmetric_sign </td> |
| 324 | <td>(</td> |
| 325 | <td class="paramtype"><a class="el" href="group__platform.html#gabf6d5fd4e2ea89ecd425c88f057e7f75">psa_key_handle_t</a> </td> |
| 326 | <td class="paramname"><em>handle</em>, </td> |
| 327 | </tr> |
| 328 | <tr> |
| 329 | <td class="paramkey"></td> |
| 330 | <td></td> |
| 331 | <td class="paramtype"><a class="el" href="group__crypto__types.html#gac2e4d47f1300d73c2f829a6d99252d69">psa_algorithm_t</a> </td> |
| 332 | <td class="paramname"><em>alg</em>, </td> |
| 333 | </tr> |
| 334 | <tr> |
| 335 | <td class="paramkey"></td> |
| 336 | <td></td> |
| 337 | <td class="paramtype">const uint8_t * </td> |
| 338 | <td class="paramname"><em>hash</em>, </td> |
| 339 | </tr> |
| 340 | <tr> |
| 341 | <td class="paramkey"></td> |
| 342 | <td></td> |
| 343 | <td class="paramtype">size_t </td> |
| 344 | <td class="paramname"><em>hash_length</em>, </td> |
| 345 | </tr> |
| 346 | <tr> |
| 347 | <td class="paramkey"></td> |
| 348 | <td></td> |
| 349 | <td class="paramtype">uint8_t * </td> |
| 350 | <td class="paramname"><em>signature</em>, </td> |
| 351 | </tr> |
| 352 | <tr> |
| 353 | <td class="paramkey"></td> |
| 354 | <td></td> |
| 355 | <td class="paramtype">size_t </td> |
| 356 | <td class="paramname"><em>signature_size</em>, </td> |
| 357 | </tr> |
| 358 | <tr> |
| 359 | <td class="paramkey"></td> |
| 360 | <td></td> |
| 361 | <td class="paramtype">size_t * </td> |
| 362 | <td class="paramname"><em>signature_length</em> </td> |
| 363 | </tr> |
| 364 | <tr> |
| 365 | <td></td> |
| 366 | <td>)</td> |
| 367 | <td></td><td></td> |
| 368 | </tr> |
| 369 | </table> |
| 370 | </div><div class="memdoc"> |
| 371 | |
| 372 | <p>Sign a hash or short message with a private key. </p> |
| 373 | <p>Note that to perform a hash-and-sign signature algorithm, you must first calculate the hash by calling <a class="el" href="group__hash.html#ga8d72896cf70fc4d514c5c6b978912515">psa_hash_setup()</a>, <a class="el" href="group__hash.html#ga65b16ef97d7f650899b7db4b7d1112ff">psa_hash_update()</a> and <a class="el" href="group__hash.html#ga4795fd06a0067b0adcd92e9627b8c97e">psa_hash_finish()</a>. Then pass the resulting hash as the <code>hash</code> parameter to this function. You can use <a class="el" href="group__crypto__types.html#ga24cf6d7bcd2b9aeeeff86f07b6c674e3">PSA_ALG_SIGN_GET_HASH</a>(<code>alg</code>) to determine the hash algorithm to use.</p> |
| 374 | <dl class="params"><dt>Parameters</dt><dd> |
| 375 | <table class="params"> |
| 376 | <tr><td class="paramdir"></td><td class="paramname">handle</td><td>Handle to the key to use for the operation. It must be an asymmetric key pair. </td></tr> |
| 377 | <tr><td class="paramdir"></td><td class="paramname">alg</td><td>A signature algorithm that is compatible with the type of <code>key</code>. </td></tr> |
| 378 | <tr><td class="paramdir">[in]</td><td class="paramname">hash</td><td>The hash or message to sign. </td></tr> |
| 379 | <tr><td class="paramdir"></td><td class="paramname">hash_length</td><td>Size of the <code>hash</code> buffer in bytes. </td></tr> |
| 380 | <tr><td class="paramdir">[out]</td><td class="paramname">signature</td><td>Buffer where the signature is to be written. </td></tr> |
| 381 | <tr><td class="paramdir"></td><td class="paramname">signature_size</td><td>Size of the <code>signature</code> buffer in bytes. </td></tr> |
| 382 | <tr><td class="paramdir">[out]</td><td class="paramname">signature_length</td><td>On success, the number of bytes that make up the returned signature value.</td></tr> |
| 383 | </table> |
| 384 | </dd> |
| 385 | </dl> |
| 386 | <dl class="retval"><dt>Return values</dt><dd> |
| 387 | <table class="retval"> |
| 388 | <tr><td class="paramname"><a class="el" href="group__error.html#ga4cc859e2c66ca381c7418db3527a65e1">PSA_SUCCESS</a></td><td></td></tr> |
| 389 | <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>signature</code> buffer is too small. You can determine a sufficient buffer size by calling <a class="el" href="crypto__sizes_8h.html#a77565b9b4fe6d8730fd2120f4c8378ab">PSA_ASYMMETRIC_SIGN_OUTPUT_SIZE</a>(<code>key_type</code>, <code>key_bits</code>, <code>alg</code>) where <code>key_type</code> and <code>key_bits</code> are the type and bit-size respectively of <code>key</code>. </td></tr> |
| 390 | <tr><td class="paramname"><a class="el" href="group__error.html#ga1dcc6d130633ed5db8942257581b55dd">PSA_ERROR_NOT_SUPPORTED</a></td><td></td></tr> |
| 391 | <tr><td class="paramname"><a class="el" href="group__error.html#ga798df25a505ebf931f7bec1f80f1f85f">PSA_ERROR_INVALID_ARGUMENT</a></td><td></td></tr> |
| 392 | <tr><td class="paramname"><a class="el" href="group__error.html#ga91b2ad8a867517a2651f1b076c5216e5">PSA_ERROR_INSUFFICIENT_MEMORY</a></td><td></td></tr> |
| 393 | <tr><td class="paramname"><a class="el" href="group__error.html#ga5cdb6948371d49e916106249020ea3f7">PSA_ERROR_COMMUNICATION_FAILURE</a></td><td></td></tr> |
| 394 | <tr><td class="paramname"><a class="el" href="group__error.html#ga08b10e70fa5ff0b05c631d9f8f6b2c6b">PSA_ERROR_HARDWARE_FAILURE</a></td><td></td></tr> |
| 395 | <tr><td class="paramname"><a class="el" href="group__error.html#ga2c5dda1485cb54f2385cb9c1279a7004">PSA_ERROR_TAMPERING_DETECTED</a></td><td></td></tr> |
| 396 | <tr><td class="paramname"><a class="el" href="group__error.html#ga4deb59fec02297ec5d8b42178323f675">PSA_ERROR_INSUFFICIENT_ENTROPY</a></td><td></td></tr> |
| 397 | <tr><td class="paramname"><a class="el" href="group__error.html#ga933d40fa2a591004f2e93aa91e11db84">PSA_ERROR_BAD_STATE</a></td><td>The library has not been previously initialized by <a class="el" href="group__initialization.html#ga2de150803fc2f7dc6101d5af7e921dd9" title="Library initialization. ">psa_crypto_init()</a>. It is implementation-dependent whether a failure to initialize results in this error code. </td></tr> |
| 398 | </table> |
| 399 | </dd> |
| 400 | </dl> |
| 401 | |
| 402 | </div> |
| 403 | </div> |
| 404 | <a class="anchor" id="ga1b8e964c8d927e3d632325d762959eb7"></a> |
| 405 | <div class="memitem"> |
| 406 | <div class="memproto"> |
| 407 | <table class="memname"> |
| 408 | <tr> |
| 409 | <td class="memname"><a class="el" href="group__error.html#ga05676e70ba5c6a7565aff3c36677c1f9">psa_status_t</a> psa_asymmetric_verify </td> |
| 410 | <td>(</td> |
| 411 | <td class="paramtype"><a class="el" href="group__platform.html#gabf6d5fd4e2ea89ecd425c88f057e7f75">psa_key_handle_t</a> </td> |
| 412 | <td class="paramname"><em>handle</em>, </td> |
| 413 | </tr> |
| 414 | <tr> |
| 415 | <td class="paramkey"></td> |
| 416 | <td></td> |
| 417 | <td class="paramtype"><a class="el" href="group__crypto__types.html#gac2e4d47f1300d73c2f829a6d99252d69">psa_algorithm_t</a> </td> |
| 418 | <td class="paramname"><em>alg</em>, </td> |
| 419 | </tr> |
| 420 | <tr> |
| 421 | <td class="paramkey"></td> |
| 422 | <td></td> |
| 423 | <td class="paramtype">const uint8_t * </td> |
| 424 | <td class="paramname"><em>hash</em>, </td> |
| 425 | </tr> |
| 426 | <tr> |
| 427 | <td class="paramkey"></td> |
| 428 | <td></td> |
| 429 | <td class="paramtype">size_t </td> |
| 430 | <td class="paramname"><em>hash_length</em>, </td> |
| 431 | </tr> |
| 432 | <tr> |
| 433 | <td class="paramkey"></td> |
| 434 | <td></td> |
| 435 | <td class="paramtype">const uint8_t * </td> |
| 436 | <td class="paramname"><em>signature</em>, </td> |
| 437 | </tr> |
| 438 | <tr> |
| 439 | <td class="paramkey"></td> |
| 440 | <td></td> |
| 441 | <td class="paramtype">size_t </td> |
| 442 | <td class="paramname"><em>signature_length</em> </td> |
| 443 | </tr> |
| 444 | <tr> |
| 445 | <td></td> |
| 446 | <td>)</td> |
| 447 | <td></td><td></td> |
| 448 | </tr> |
| 449 | </table> |
| 450 | </div><div class="memdoc"> |
| 451 | |
| 452 | <p>Verify the signature a hash or short message using a public key. </p> |
| 453 | <p>Note that to perform a hash-and-sign signature algorithm, you must first calculate the hash by calling <a class="el" href="group__hash.html#ga8d72896cf70fc4d514c5c6b978912515">psa_hash_setup()</a>, <a class="el" href="group__hash.html#ga65b16ef97d7f650899b7db4b7d1112ff">psa_hash_update()</a> and <a class="el" href="group__hash.html#ga4795fd06a0067b0adcd92e9627b8c97e">psa_hash_finish()</a>. Then pass the resulting hash as the <code>hash</code> parameter to this function. You can use <a class="el" href="group__crypto__types.html#ga24cf6d7bcd2b9aeeeff86f07b6c674e3">PSA_ALG_SIGN_GET_HASH</a>(<code>alg</code>) to determine the hash algorithm to use.</p> |
| 454 | <dl class="params"><dt>Parameters</dt><dd> |
| 455 | <table class="params"> |
| 456 | <tr><td class="paramdir"></td><td class="paramname">handle</td><td>Handle to the key to use for the operation. It must be a public key or an asymmetric key pair. </td></tr> |
| 457 | <tr><td class="paramdir"></td><td class="paramname">alg</td><td>A signature algorithm that is compatible with the type of <code>key</code>. </td></tr> |
| 458 | <tr><td class="paramdir">[in]</td><td class="paramname">hash</td><td>The hash or message whose signature is to be verified. </td></tr> |
| 459 | <tr><td class="paramdir"></td><td class="paramname">hash_length</td><td>Size of the <code>hash</code> buffer in bytes. </td></tr> |
| 460 | <tr><td class="paramdir">[in]</td><td class="paramname">signature</td><td>Buffer containing the signature to verify. </td></tr> |
| 461 | <tr><td class="paramdir"></td><td class="paramname">signature_length</td><td>Size of the <code>signature</code> buffer in bytes.</td></tr> |
| 462 | </table> |
| 463 | </dd> |
| 464 | </dl> |
| 465 | <dl class="retval"><dt>Return values</dt><dd> |
| 466 | <table class="retval"> |
| 467 | <tr><td class="paramname"><a class="el" href="group__error.html#ga4cc859e2c66ca381c7418db3527a65e1">PSA_SUCCESS</a></td><td>The signature is valid. </td></tr> |
| 468 | <tr><td class="paramname"><a class="el" href="group__error.html#ga35927f755d232c4766de600f2c49e9f2">PSA_ERROR_INVALID_SIGNATURE</a></td><td>The calculation was perfomed successfully, but the passed signature is not a valid signature. </td></tr> |
| 469 | <tr><td class="paramname"><a class="el" href="group__error.html#ga1dcc6d130633ed5db8942257581b55dd">PSA_ERROR_NOT_SUPPORTED</a></td><td></td></tr> |
| 470 | <tr><td class="paramname"><a class="el" href="group__error.html#ga798df25a505ebf931f7bec1f80f1f85f">PSA_ERROR_INVALID_ARGUMENT</a></td><td></td></tr> |
| 471 | <tr><td class="paramname"><a class="el" href="group__error.html#ga91b2ad8a867517a2651f1b076c5216e5">PSA_ERROR_INSUFFICIENT_MEMORY</a></td><td></td></tr> |
| 472 | <tr><td class="paramname"><a class="el" href="group__error.html#ga5cdb6948371d49e916106249020ea3f7">PSA_ERROR_COMMUNICATION_FAILURE</a></td><td></td></tr> |
| 473 | <tr><td class="paramname"><a class="el" href="group__error.html#ga08b10e70fa5ff0b05c631d9f8f6b2c6b">PSA_ERROR_HARDWARE_FAILURE</a></td><td></td></tr> |
| 474 | <tr><td class="paramname"><a class="el" href="group__error.html#ga2c5dda1485cb54f2385cb9c1279a7004">PSA_ERROR_TAMPERING_DETECTED</a></td><td></td></tr> |
| 475 | <tr><td class="paramname"><a class="el" href="group__error.html#ga933d40fa2a591004f2e93aa91e11db84">PSA_ERROR_BAD_STATE</a></td><td>The library has not been previously initialized by <a class="el" href="group__initialization.html#ga2de150803fc2f7dc6101d5af7e921dd9" title="Library initialization. ">psa_crypto_init()</a>. It is implementation-dependent whether a failure to initialize results in this error code. </td></tr> |
| 476 | </table> |
| 477 | </dd> |
| 478 | </dl> |
| 479 | |
| 480 | </div> |
| 481 | </div> |
| 482 | </div><!-- contents --> |
| 483 | <!-- start footer part --> |
| 484 | <hr class="footer"/><address class="footer"><small> |
| 485 | Generated by  <a href="http://www.doxygen.org/index.html"> |
| 486 | <img class="footer" src="doxygen.png" alt="doxygen"/> |
| 487 | </a> 1.8.11 |
| 488 | </small></address> |
| 489 | </body> |
| 490 | </html> |