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: Key policies</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">Key policies</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:ga5e6bc5f550e88fdc7790f2a75e79f7c5"><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="group__policy.html#ga5e6bc5f550e88fdc7790f2a75e79f7c5">PSA_KEY_POLICY_INIT</a>   {0}</td></tr> |
| 91 | <tr class="separator:ga5e6bc5f550e88fdc7790f2a75e79f7c5"><td class="memSeparator" colspan="2"> </td></tr> |
| 92 | <tr class="memitem:ga7dddccdd1303176e87a4d20c87b589ed"><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="group__policy.html#ga7dddccdd1303176e87a4d20c87b589ed">PSA_KEY_USAGE_EXPORT</a>   ((<a class="el" href="group__policy.html#ga7bb9de71337e0e98de843aa7f9b55f25">psa_key_usage_t</a>)0x00000001)</td></tr> |
| 93 | <tr class="separator:ga7dddccdd1303176e87a4d20c87b589ed"><td class="memSeparator" colspan="2"> </td></tr> |
| 94 | <tr class="memitem:ga75153b296d045d529d97203a6a995dad"><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="group__policy.html#ga75153b296d045d529d97203a6a995dad">PSA_KEY_USAGE_ENCRYPT</a>   ((<a class="el" href="group__policy.html#ga7bb9de71337e0e98de843aa7f9b55f25">psa_key_usage_t</a>)0x00000100)</td></tr> |
| 95 | <tr class="separator:ga75153b296d045d529d97203a6a995dad"><td class="memSeparator" colspan="2"> </td></tr> |
| 96 | <tr class="memitem:gac3f2d2e5983db1edde9f142ca9bf8e6a"><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="group__policy.html#gac3f2d2e5983db1edde9f142ca9bf8e6a">PSA_KEY_USAGE_DECRYPT</a>   ((<a class="el" href="group__policy.html#ga7bb9de71337e0e98de843aa7f9b55f25">psa_key_usage_t</a>)0x00000200)</td></tr> |
| 97 | <tr class="separator:gac3f2d2e5983db1edde9f142ca9bf8e6a"><td class="memSeparator" colspan="2"> </td></tr> |
| 98 | <tr class="memitem:ga99b9f456cf59efc4b5579465407aef5a"><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="group__policy.html#ga99b9f456cf59efc4b5579465407aef5a">PSA_KEY_USAGE_SIGN</a>   ((<a class="el" href="group__policy.html#ga7bb9de71337e0e98de843aa7f9b55f25">psa_key_usage_t</a>)0x00000400)</td></tr> |
| 99 | <tr class="separator:ga99b9f456cf59efc4b5579465407aef5a"><td class="memSeparator" colspan="2"> </td></tr> |
| 100 | <tr class="memitem:ga39b54ffd5958b69634607924fa53cea6"><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="group__policy.html#ga39b54ffd5958b69634607924fa53cea6">PSA_KEY_USAGE_VERIFY</a>   ((<a class="el" href="group__policy.html#ga7bb9de71337e0e98de843aa7f9b55f25">psa_key_usage_t</a>)0x00000800)</td></tr> |
| 101 | <tr class="separator:ga39b54ffd5958b69634607924fa53cea6"><td class="memSeparator" colspan="2"> </td></tr> |
| 102 | <tr class="memitem:gaf19022acc5ef23cf12477f632b48a0b2"><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="group__policy.html#gaf19022acc5ef23cf12477f632b48a0b2">PSA_KEY_USAGE_DERIVE</a>   ((<a class="el" href="group__policy.html#ga7bb9de71337e0e98de843aa7f9b55f25">psa_key_usage_t</a>)0x00001000)</td></tr> |
| 103 | <tr class="separator:gaf19022acc5ef23cf12477f632b48a0b2"><td class="memSeparator" colspan="2"> </td></tr> |
| 104 | </table><table class="memberdecls"> |
| 105 | <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="typedef-members"></a> |
| 106 | Typedefs</h2></td></tr> |
| 107 | <tr class="memitem:gaf553efd409845b6d09ff25ce2ba36607"><td class="memItemLeft" align="right" valign="top">typedef struct psa_key_policy_s </td><td class="memItemRight" valign="bottom"><a class="el" href="group__policy.html#gaf553efd409845b6d09ff25ce2ba36607">psa_key_policy_t</a></td></tr> |
| 108 | <tr class="separator:gaf553efd409845b6d09ff25ce2ba36607"><td class="memSeparator" colspan="2"> </td></tr> |
| 109 | <tr class="memitem:ga7bb9de71337e0e98de843aa7f9b55f25"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ga7bb9de71337e0e98de843aa7f9b55f25"></a> |
| 110 | typedef uint32_t </td><td class="memItemRight" valign="bottom"><a class="el" href="group__policy.html#ga7bb9de71337e0e98de843aa7f9b55f25">psa_key_usage_t</a></td></tr> |
| 111 | <tr class="memdesc:ga7bb9de71337e0e98de843aa7f9b55f25"><td class="mdescLeft"> </td><td class="mdescRight">Encoding of permitted usage on a key. <br /></td></tr> |
| 112 | <tr class="separator:ga7bb9de71337e0e98de843aa7f9b55f25"><td class="memSeparator" colspan="2"> </td></tr> |
| 113 | </table><table class="memberdecls"> |
| 114 | <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a> |
| 115 | Functions</h2></td></tr> |
| 116 | <tr class="memitem:gac16792fd6d375a5f76d372090df40607"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="group__policy.html#gac16792fd6d375a5f76d372090df40607">psa_key_policy_set_usage</a> (<a class="el" href="group__policy.html#gaf553efd409845b6d09ff25ce2ba36607">psa_key_policy_t</a> *policy, <a class="el" href="group__policy.html#ga7bb9de71337e0e98de843aa7f9b55f25">psa_key_usage_t</a> usage, <a class="el" href="group__crypto__types.html#gac2e4d47f1300d73c2f829a6d99252d69">psa_algorithm_t</a> alg)</td></tr> |
| 117 | <tr class="memdesc:gac16792fd6d375a5f76d372090df40607"><td class="mdescLeft"> </td><td class="mdescRight">Set the standard fields of a policy structure. <a href="#gac16792fd6d375a5f76d372090df40607">More...</a><br /></td></tr> |
| 118 | <tr class="separator:gac16792fd6d375a5f76d372090df40607"><td class="memSeparator" colspan="2"> </td></tr> |
| 119 | <tr class="memitem:ga7746662b7503e484774d0ecb5d8ac2ab"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__policy.html#ga7bb9de71337e0e98de843aa7f9b55f25">psa_key_usage_t</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="group__policy.html#ga7746662b7503e484774d0ecb5d8ac2ab">psa_key_policy_get_usage</a> (const <a class="el" href="group__policy.html#gaf553efd409845b6d09ff25ce2ba36607">psa_key_policy_t</a> *policy)</td></tr> |
| 120 | <tr class="memdesc:ga7746662b7503e484774d0ecb5d8ac2ab"><td class="mdescLeft"> </td><td class="mdescRight">Retrieve the usage field of a policy structure. <a href="#ga7746662b7503e484774d0ecb5d8ac2ab">More...</a><br /></td></tr> |
| 121 | <tr class="separator:ga7746662b7503e484774d0ecb5d8ac2ab"><td class="memSeparator" colspan="2"> </td></tr> |
| 122 | <tr class="memitem:gaadf16b89ace53e1d2cb5bcb0aef24c86"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__crypto__types.html#gac2e4d47f1300d73c2f829a6d99252d69">psa_algorithm_t</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="group__policy.html#gaadf16b89ace53e1d2cb5bcb0aef24c86">psa_key_policy_get_algorithm</a> (const <a class="el" href="group__policy.html#gaf553efd409845b6d09ff25ce2ba36607">psa_key_policy_t</a> *policy)</td></tr> |
| 123 | <tr class="memdesc:gaadf16b89ace53e1d2cb5bcb0aef24c86"><td class="mdescLeft"> </td><td class="mdescRight">Retrieve the algorithm field of a policy structure. <a href="#gaadf16b89ace53e1d2cb5bcb0aef24c86">More...</a><br /></td></tr> |
| 124 | <tr class="separator:gaadf16b89ace53e1d2cb5bcb0aef24c86"><td class="memSeparator" colspan="2"> </td></tr> |
| 125 | <tr class="memitem:ga1e2a6e50b621864f95d438222a3c640b"><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__policy.html#ga1e2a6e50b621864f95d438222a3c640b">psa_set_key_policy</a> (<a class="el" href="group__platform.html#gabf6d5fd4e2ea89ecd425c88f057e7f75">psa_key_handle_t</a> handle, const <a class="el" href="group__policy.html#gaf553efd409845b6d09ff25ce2ba36607">psa_key_policy_t</a> *policy)</td></tr> |
| 126 | <tr class="memdesc:ga1e2a6e50b621864f95d438222a3c640b"><td class="mdescLeft"> </td><td class="mdescRight">Set the usage policy on a key slot. <a href="#ga1e2a6e50b621864f95d438222a3c640b">More...</a><br /></td></tr> |
| 127 | <tr class="separator:ga1e2a6e50b621864f95d438222a3c640b"><td class="memSeparator" colspan="2"> </td></tr> |
| 128 | <tr class="memitem:gaed087d1386b807edee66b2e445ba9111"><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__policy.html#gaed087d1386b807edee66b2e445ba9111">psa_get_key_policy</a> (<a class="el" href="group__platform.html#gabf6d5fd4e2ea89ecd425c88f057e7f75">psa_key_handle_t</a> handle, <a class="el" href="group__policy.html#gaf553efd409845b6d09ff25ce2ba36607">psa_key_policy_t</a> *policy)</td></tr> |
| 129 | <tr class="memdesc:gaed087d1386b807edee66b2e445ba9111"><td class="mdescLeft"> </td><td class="mdescRight">Get the usage policy for a key slot. <a href="#gaed087d1386b807edee66b2e445ba9111">More...</a><br /></td></tr> |
| 130 | <tr class="separator:gaed087d1386b807edee66b2e445ba9111"><td class="memSeparator" colspan="2"> </td></tr> |
| 131 | </table> |
| 132 | <a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2> |
| 133 | <h2 class="groupheader">Macro Definition Documentation</h2> |
| 134 | <a class="anchor" id="ga5e6bc5f550e88fdc7790f2a75e79f7c5"></a> |
| 135 | <div class="memitem"> |
| 136 | <div class="memproto"> |
| 137 | <table class="memname"> |
| 138 | <tr> |
| 139 | <td class="memname">#define PSA_KEY_POLICY_INIT   {0}</td> |
| 140 | </tr> |
| 141 | </table> |
| 142 | </div><div class="memdoc"> |
| 143 | <p>This macro returns a suitable initializer for a key policy object of type <a class="el" href="group__policy.html#gaf553efd409845b6d09ff25ce2ba36607">psa_key_policy_t</a>. </p> |
| 144 | |
| 145 | </div> |
| 146 | </div> |
| 147 | <a class="anchor" id="gac3f2d2e5983db1edde9f142ca9bf8e6a"></a> |
| 148 | <div class="memitem"> |
| 149 | <div class="memproto"> |
| 150 | <table class="memname"> |
| 151 | <tr> |
| 152 | <td class="memname">#define PSA_KEY_USAGE_DECRYPT   ((<a class="el" href="group__policy.html#ga7bb9de71337e0e98de843aa7f9b55f25">psa_key_usage_t</a>)0x00000200)</td> |
| 153 | </tr> |
| 154 | </table> |
| 155 | </div><div class="memdoc"> |
| 156 | <p>Whether the key may be used to decrypt a message.</p> |
| 157 | <p>This flag allows the key to be used for a symmetric decryption operation, for an AEAD decryption-and-verification operation, or for an asymmetric decryption operation, if otherwise permitted by the key's type and policy.</p> |
| 158 | <p>For a key pair, this concerns the private key. </p> |
| 159 | |
| 160 | </div> |
| 161 | </div> |
| 162 | <a class="anchor" id="gaf19022acc5ef23cf12477f632b48a0b2"></a> |
| 163 | <div class="memitem"> |
| 164 | <div class="memproto"> |
| 165 | <table class="memname"> |
| 166 | <tr> |
| 167 | <td class="memname">#define PSA_KEY_USAGE_DERIVE   ((<a class="el" href="group__policy.html#ga7bb9de71337e0e98de843aa7f9b55f25">psa_key_usage_t</a>)0x00001000)</td> |
| 168 | </tr> |
| 169 | </table> |
| 170 | </div><div class="memdoc"> |
| 171 | <p>Whether the key may be used to derive other keys. </p> |
| 172 | |
| 173 | </div> |
| 174 | </div> |
| 175 | <a class="anchor" id="ga75153b296d045d529d97203a6a995dad"></a> |
| 176 | <div class="memitem"> |
| 177 | <div class="memproto"> |
| 178 | <table class="memname"> |
| 179 | <tr> |
| 180 | <td class="memname">#define PSA_KEY_USAGE_ENCRYPT   ((<a class="el" href="group__policy.html#ga7bb9de71337e0e98de843aa7f9b55f25">psa_key_usage_t</a>)0x00000100)</td> |
| 181 | </tr> |
| 182 | </table> |
| 183 | </div><div class="memdoc"> |
| 184 | <p>Whether the key may be used to encrypt a message.</p> |
| 185 | <p>This flag allows the key to be used for a symmetric encryption operation, for an AEAD encryption-and-authentication operation, or for an asymmetric encryption operation, if otherwise permitted by the key's type and policy.</p> |
| 186 | <p>For a key pair, this concerns the public key. </p> |
| 187 | |
| 188 | </div> |
| 189 | </div> |
| 190 | <a class="anchor" id="ga7dddccdd1303176e87a4d20c87b589ed"></a> |
| 191 | <div class="memitem"> |
| 192 | <div class="memproto"> |
| 193 | <table class="memname"> |
| 194 | <tr> |
| 195 | <td class="memname">#define PSA_KEY_USAGE_EXPORT   ((<a class="el" href="group__policy.html#ga7bb9de71337e0e98de843aa7f9b55f25">psa_key_usage_t</a>)0x00000001)</td> |
| 196 | </tr> |
| 197 | </table> |
| 198 | </div><div class="memdoc"> |
| 199 | <p>Whether the key may be exported.</p> |
| 200 | <p>A public key or the public part of a key pair may always be exported regardless of the value of this permission flag.</p> |
| 201 | <p>If a key does not have export permission, implementations shall not allow the key to be exported in plain form from the cryptoprocessor, whether through <a class="el" href="group__import__export.html#ga902b9a7a6cf34d6111668be777b05eaf" title="Export a key in binary format. ">psa_export_key()</a> or through a proprietary interface. The key may however be exportable in a wrapped form, i.e. in a form where it is encrypted by another key. </p> |
| 202 | |
| 203 | </div> |
| 204 | </div> |
| 205 | <a class="anchor" id="ga99b9f456cf59efc4b5579465407aef5a"></a> |
| 206 | <div class="memitem"> |
| 207 | <div class="memproto"> |
| 208 | <table class="memname"> |
| 209 | <tr> |
| 210 | <td class="memname">#define PSA_KEY_USAGE_SIGN   ((<a class="el" href="group__policy.html#ga7bb9de71337e0e98de843aa7f9b55f25">psa_key_usage_t</a>)0x00000400)</td> |
| 211 | </tr> |
| 212 | </table> |
| 213 | </div><div class="memdoc"> |
| 214 | <p>Whether the key may be used to sign a message.</p> |
| 215 | <p>This flag allows the key to be used for a MAC calculation operation or for an asymmetric signature operation, if otherwise permitted by the key's type and policy.</p> |
| 216 | <p>For a key pair, this concerns the private key. </p> |
| 217 | |
| 218 | </div> |
| 219 | </div> |
| 220 | <a class="anchor" id="ga39b54ffd5958b69634607924fa53cea6"></a> |
| 221 | <div class="memitem"> |
| 222 | <div class="memproto"> |
| 223 | <table class="memname"> |
| 224 | <tr> |
| 225 | <td class="memname">#define PSA_KEY_USAGE_VERIFY   ((<a class="el" href="group__policy.html#ga7bb9de71337e0e98de843aa7f9b55f25">psa_key_usage_t</a>)0x00000800)</td> |
| 226 | </tr> |
| 227 | </table> |
| 228 | </div><div class="memdoc"> |
| 229 | <p>Whether the key may be used to verify a message signature.</p> |
| 230 | <p>This flag allows the key to be used for a MAC verification operation or for an asymmetric signature verification operation, if otherwise permitted by by the key's type and policy.</p> |
| 231 | <p>For a key pair, this concerns the public key. </p> |
| 232 | |
| 233 | </div> |
| 234 | </div> |
| 235 | <h2 class="groupheader">Typedef Documentation</h2> |
| 236 | <a class="anchor" id="gaf553efd409845b6d09ff25ce2ba36607"></a> |
| 237 | <div class="memitem"> |
| 238 | <div class="memproto"> |
| 239 | <table class="memname"> |
| 240 | <tr> |
| 241 | <td class="memname">typedef struct psa_key_policy_s <a class="el" href="group__policy.html#gaf553efd409845b6d09ff25ce2ba36607">psa_key_policy_t</a></td> |
| 242 | </tr> |
| 243 | </table> |
| 244 | </div><div class="memdoc"> |
| 245 | <p>The type of the key policy data structure.</p> |
| 246 | <p>Before calling any function on a key policy, the application must initialize it by any of the following means:</p><ul> |
| 247 | <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_key_policy_t policy;</div><div class="line"><a name="l00002"></a><span class="lineno"> 2</span> memset(&policy, 0, sizeof(policy));</div></div><!-- fragment --></li> |
| 248 | <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_key_policy_t policy = {0};</div></div><!-- fragment --></li> |
| 249 | <li>Initialize the structure to the initializer <a class="el" href="group__policy.html#ga5e6bc5f550e88fdc7790f2a75e79f7c5">PSA_KEY_POLICY_INIT</a>, for example: <div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno"> 1</span> psa_key_policy_t policy = PSA_KEY_POLICY_INIT;</div></div><!-- fragment --></li> |
| 250 | <li>Assign the result of the function psa_key_policy_init() to the structure, for example: <div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno"> 1</span> psa_key_policy_t policy;</div><div class="line"><a name="l00002"></a><span class="lineno"> 2</span> policy = psa_key_policy_init();</div></div><!-- fragment --></li> |
| 251 | </ul> |
| 252 | <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> |
| 253 | |
| 254 | </div> |
| 255 | </div> |
| 256 | <h2 class="groupheader">Function Documentation</h2> |
| 257 | <a class="anchor" id="gaed087d1386b807edee66b2e445ba9111"></a> |
| 258 | <div class="memitem"> |
| 259 | <div class="memproto"> |
| 260 | <table class="memname"> |
| 261 | <tr> |
| 262 | <td class="memname"><a class="el" href="group__error.html#ga05676e70ba5c6a7565aff3c36677c1f9">psa_status_t</a> psa_get_key_policy </td> |
| 263 | <td>(</td> |
| 264 | <td class="paramtype"><a class="el" href="group__platform.html#gabf6d5fd4e2ea89ecd425c88f057e7f75">psa_key_handle_t</a> </td> |
| 265 | <td class="paramname"><em>handle</em>, </td> |
| 266 | </tr> |
| 267 | <tr> |
| 268 | <td class="paramkey"></td> |
| 269 | <td></td> |
| 270 | <td class="paramtype"><a class="el" href="group__policy.html#gaf553efd409845b6d09ff25ce2ba36607">psa_key_policy_t</a> * </td> |
| 271 | <td class="paramname"><em>policy</em> </td> |
| 272 | </tr> |
| 273 | <tr> |
| 274 | <td></td> |
| 275 | <td>)</td> |
| 276 | <td></td><td></td> |
| 277 | </tr> |
| 278 | </table> |
| 279 | </div><div class="memdoc"> |
| 280 | |
| 281 | <p>Get the usage policy for a key slot. </p> |
| 282 | <dl class="params"><dt>Parameters</dt><dd> |
| 283 | <table class="params"> |
| 284 | <tr><td class="paramdir"></td><td class="paramname">handle</td><td>Handle to the key slot whose policy is being queried. </td></tr> |
| 285 | <tr><td class="paramdir">[out]</td><td class="paramname">policy</td><td>On success, the key's policy.</td></tr> |
| 286 | </table> |
| 287 | </dd> |
| 288 | </dl> |
| 289 | <dl class="retval"><dt>Return values</dt><dd> |
| 290 | <table class="retval"> |
| 291 | <tr><td class="paramname"><a class="el" href="group__error.html#ga4cc859e2c66ca381c7418db3527a65e1">PSA_SUCCESS</a></td><td></td></tr> |
| 292 | <tr><td class="paramname"><a class="el" href="group__error.html#gadf22718935657c2c3168c228204085f9">PSA_ERROR_INVALID_HANDLE</a></td><td></td></tr> |
| 293 | <tr><td class="paramname"><a class="el" href="group__error.html#ga5cdb6948371d49e916106249020ea3f7">PSA_ERROR_COMMUNICATION_FAILURE</a></td><td></td></tr> |
| 294 | <tr><td class="paramname"><a class="el" href="group__error.html#ga08b10e70fa5ff0b05c631d9f8f6b2c6b">PSA_ERROR_HARDWARE_FAILURE</a></td><td></td></tr> |
| 295 | <tr><td class="paramname"><a class="el" href="group__error.html#ga2c5dda1485cb54f2385cb9c1279a7004">PSA_ERROR_TAMPERING_DETECTED</a></td><td></td></tr> |
| 296 | <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> |
| 297 | </table> |
| 298 | </dd> |
| 299 | </dl> |
| 300 | |
| 301 | </div> |
| 302 | </div> |
| 303 | <a class="anchor" id="gaadf16b89ace53e1d2cb5bcb0aef24c86"></a> |
| 304 | <div class="memitem"> |
| 305 | <div class="memproto"> |
| 306 | <table class="memname"> |
| 307 | <tr> |
| 308 | <td class="memname"><a class="el" href="group__crypto__types.html#gac2e4d47f1300d73c2f829a6d99252d69">psa_algorithm_t</a> psa_key_policy_get_algorithm </td> |
| 309 | <td>(</td> |
| 310 | <td class="paramtype">const <a class="el" href="group__policy.html#gaf553efd409845b6d09ff25ce2ba36607">psa_key_policy_t</a> * </td> |
| 311 | <td class="paramname"><em>policy</em></td><td>)</td> |
| 312 | <td></td> |
| 313 | </tr> |
| 314 | </table> |
| 315 | </div><div class="memdoc"> |
| 316 | |
| 317 | <p>Retrieve the algorithm field of a policy structure. </p> |
| 318 | <dl class="params"><dt>Parameters</dt><dd> |
| 319 | <table class="params"> |
| 320 | <tr><td class="paramdir">[in]</td><td class="paramname">policy</td><td>The policy object to query.</td></tr> |
| 321 | </table> |
| 322 | </dd> |
| 323 | </dl> |
| 324 | <dl class="section return"><dt>Returns</dt><dd>The permitted algorithm for a key with this policy. </dd></dl> |
| 325 | |
| 326 | </div> |
| 327 | </div> |
| 328 | <a class="anchor" id="ga7746662b7503e484774d0ecb5d8ac2ab"></a> |
| 329 | <div class="memitem"> |
| 330 | <div class="memproto"> |
| 331 | <table class="memname"> |
| 332 | <tr> |
| 333 | <td class="memname"><a class="el" href="group__policy.html#ga7bb9de71337e0e98de843aa7f9b55f25">psa_key_usage_t</a> psa_key_policy_get_usage </td> |
| 334 | <td>(</td> |
| 335 | <td class="paramtype">const <a class="el" href="group__policy.html#gaf553efd409845b6d09ff25ce2ba36607">psa_key_policy_t</a> * </td> |
| 336 | <td class="paramname"><em>policy</em></td><td>)</td> |
| 337 | <td></td> |
| 338 | </tr> |
| 339 | </table> |
| 340 | </div><div class="memdoc"> |
| 341 | |
| 342 | <p>Retrieve the usage field of a policy structure. </p> |
| 343 | <dl class="params"><dt>Parameters</dt><dd> |
| 344 | <table class="params"> |
| 345 | <tr><td class="paramdir">[in]</td><td class="paramname">policy</td><td>The policy object to query.</td></tr> |
| 346 | </table> |
| 347 | </dd> |
| 348 | </dl> |
| 349 | <dl class="section return"><dt>Returns</dt><dd>The permitted uses for a key with this policy. </dd></dl> |
| 350 | |
| 351 | </div> |
| 352 | </div> |
| 353 | <a class="anchor" id="gac16792fd6d375a5f76d372090df40607"></a> |
| 354 | <div class="memitem"> |
| 355 | <div class="memproto"> |
| 356 | <table class="memname"> |
| 357 | <tr> |
| 358 | <td class="memname">void psa_key_policy_set_usage </td> |
| 359 | <td>(</td> |
| 360 | <td class="paramtype"><a class="el" href="group__policy.html#gaf553efd409845b6d09ff25ce2ba36607">psa_key_policy_t</a> * </td> |
| 361 | <td class="paramname"><em>policy</em>, </td> |
| 362 | </tr> |
| 363 | <tr> |
| 364 | <td class="paramkey"></td> |
| 365 | <td></td> |
| 366 | <td class="paramtype"><a class="el" href="group__policy.html#ga7bb9de71337e0e98de843aa7f9b55f25">psa_key_usage_t</a> </td> |
| 367 | <td class="paramname"><em>usage</em>, </td> |
| 368 | </tr> |
| 369 | <tr> |
| 370 | <td class="paramkey"></td> |
| 371 | <td></td> |
| 372 | <td class="paramtype"><a class="el" href="group__crypto__types.html#gac2e4d47f1300d73c2f829a6d99252d69">psa_algorithm_t</a> </td> |
| 373 | <td class="paramname"><em>alg</em> </td> |
| 374 | </tr> |
| 375 | <tr> |
| 376 | <td></td> |
| 377 | <td>)</td> |
| 378 | <td></td><td></td> |
| 379 | </tr> |
| 380 | </table> |
| 381 | </div><div class="memdoc"> |
| 382 | |
| 383 | <p>Set the standard fields of a policy structure. </p> |
| 384 | <p>Note that this function does not make any consistency check of the parameters. The values are only checked when applying the policy to a key slot with <a class="el" href="group__policy.html#ga1e2a6e50b621864f95d438222a3c640b" title="Set the usage policy on a key slot. ">psa_set_key_policy()</a>.</p> |
| 385 | <dl class="params"><dt>Parameters</dt><dd> |
| 386 | <table class="params"> |
| 387 | <tr><td class="paramdir">[in,out]</td><td class="paramname">policy</td><td>The key policy to modify. It must have been initialized as per the documentation for <a class="el" href="group__policy.html#gaf553efd409845b6d09ff25ce2ba36607">psa_key_policy_t</a>. </td></tr> |
| 388 | <tr><td class="paramdir"></td><td class="paramname">usage</td><td>The permitted uses for the key. </td></tr> |
| 389 | <tr><td class="paramdir"></td><td class="paramname">alg</td><td>The algorithm that the key may be used for. </td></tr> |
| 390 | </table> |
| 391 | </dd> |
| 392 | </dl> |
| 393 | |
| 394 | </div> |
| 395 | </div> |
| 396 | <a class="anchor" id="ga1e2a6e50b621864f95d438222a3c640b"></a> |
| 397 | <div class="memitem"> |
| 398 | <div class="memproto"> |
| 399 | <table class="memname"> |
| 400 | <tr> |
| 401 | <td class="memname"><a class="el" href="group__error.html#ga05676e70ba5c6a7565aff3c36677c1f9">psa_status_t</a> psa_set_key_policy </td> |
| 402 | <td>(</td> |
| 403 | <td class="paramtype"><a class="el" href="group__platform.html#gabf6d5fd4e2ea89ecd425c88f057e7f75">psa_key_handle_t</a> </td> |
| 404 | <td class="paramname"><em>handle</em>, </td> |
| 405 | </tr> |
| 406 | <tr> |
| 407 | <td class="paramkey"></td> |
| 408 | <td></td> |
| 409 | <td class="paramtype">const <a class="el" href="group__policy.html#gaf553efd409845b6d09ff25ce2ba36607">psa_key_policy_t</a> * </td> |
| 410 | <td class="paramname"><em>policy</em> </td> |
| 411 | </tr> |
| 412 | <tr> |
| 413 | <td></td> |
| 414 | <td>)</td> |
| 415 | <td></td><td></td> |
| 416 | </tr> |
| 417 | </table> |
| 418 | </div><div class="memdoc"> |
| 419 | |
| 420 | <p>Set the usage policy on a key slot. </p> |
| 421 | <p>This function must be called on an empty key slot, before importing, generating or creating a key in the slot. Changing the policy of an existing key is not permitted.</p> |
| 422 | <p>Implementations may set restrictions on supported key policies depending on the key type and the key slot.</p> |
| 423 | <dl class="params"><dt>Parameters</dt><dd> |
| 424 | <table class="params"> |
| 425 | <tr><td class="paramdir"></td><td class="paramname">handle</td><td>Handle to the key whose policy is to be changed. </td></tr> |
| 426 | <tr><td class="paramdir">[in]</td><td class="paramname">policy</td><td>The policy object to query.</td></tr> |
| 427 | </table> |
| 428 | </dd> |
| 429 | </dl> |
| 430 | <dl class="retval"><dt>Return values</dt><dd> |
| 431 | <table class="retval"> |
| 432 | <tr><td class="paramname"><a class="el" href="group__error.html#ga4cc859e2c66ca381c7418db3527a65e1">PSA_SUCCESS</a></td><td>Success. If the key is persistent, it is implementation-defined whether the policy has been saved to persistent storage. Implementations may defer saving the policy until the key material is created. </td></tr> |
| 433 | <tr><td class="paramname"><a class="el" href="group__error.html#gadf22718935657c2c3168c228204085f9">PSA_ERROR_INVALID_HANDLE</a></td><td></td></tr> |
| 434 | <tr><td class="paramname"><a class="el" href="group__error.html#gac2fee3a51249fbea45360aaa911f3e58">PSA_ERROR_OCCUPIED_SLOT</a></td><td></td></tr> |
| 435 | <tr><td class="paramname"><a class="el" href="group__error.html#ga1dcc6d130633ed5db8942257581b55dd">PSA_ERROR_NOT_SUPPORTED</a></td><td></td></tr> |
| 436 | <tr><td class="paramname"><a class="el" href="group__error.html#ga798df25a505ebf931f7bec1f80f1f85f">PSA_ERROR_INVALID_ARGUMENT</a></td><td></td></tr> |
| 437 | <tr><td class="paramname"><a class="el" href="group__error.html#ga5cdb6948371d49e916106249020ea3f7">PSA_ERROR_COMMUNICATION_FAILURE</a></td><td></td></tr> |
| 438 | <tr><td class="paramname"><a class="el" href="group__error.html#ga08b10e70fa5ff0b05c631d9f8f6b2c6b">PSA_ERROR_HARDWARE_FAILURE</a></td><td></td></tr> |
| 439 | <tr><td class="paramname"><a class="el" href="group__error.html#ga2c5dda1485cb54f2385cb9c1279a7004">PSA_ERROR_TAMPERING_DETECTED</a></td><td></td></tr> |
| 440 | <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> |
| 441 | </table> |
| 442 | </dd> |
| 443 | </dl> |
| 444 | |
| 445 | </div> |
| 446 | </div> |
| 447 | </div><!-- contents --> |
| 448 | <!-- start footer part --> |
| 449 | <hr class="footer"/><address class="footer"><small> |
| 450 | Generated by  <a href="http://www.doxygen.org/index.html"> |
| 451 | <img class="footer" src="doxygen.png" alt="doxygen"/> |
| 452 | </a> 1.8.11 |
| 453 | </small></address> |
| 454 | </body> |
| 455 | </html> |