Gilles Peskine | 6c723a2 | 2020-04-17 16:57:52 +0200 | [diff] [blame] | 1 | |
| 2 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" |
| 3 | "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
| 4 | |
| 5 | <html xmlns="http://www.w3.org/1999/xhtml"> |
| 6 | <head> |
| 7 | <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> |
| 8 | <title>Algorithms — PSA Crypto API 1.0.0 documentation</title> |
| 9 | <link rel="stylesheet" href="../../_static/alabaster.css" type="text/css" /> |
| 10 | <link rel="stylesheet" href="../../_static/pygments.css" type="text/css" /> |
| 11 | <script type="text/javascript"> |
| 12 | var DOCUMENTATION_OPTIONS = { |
| 13 | URL_ROOT: '../../', |
| 14 | VERSION: '1.0.0', |
| 15 | COLLAPSE_INDEX: false, |
| 16 | FILE_SUFFIX: '.html', |
| 17 | HAS_SOURCE: true, |
| 18 | SOURCELINK_SUFFIX: '.txt' |
| 19 | }; |
| 20 | </script> |
| 21 | <script type="text/javascript" src="../../_static/jquery.js"></script> |
| 22 | <script type="text/javascript" src="../../_static/underscore.js"></script> |
| 23 | <script type="text/javascript" src="../../_static/doctools.js"></script> |
| 24 | <link rel="index" title="Index" href="../../genindex.html" /> |
| 25 | <link rel="search" title="Search" href="../../search.html" /> |
| 26 | <link rel="next" title="Key management functions" href="management.html" /> |
| 27 | <link rel="prev" title="Key policies" href="usage.html" /> |
| 28 | |
| 29 | <link rel="stylesheet" href="../../_static/custom.css" type="text/css" /> |
| 30 | |
| 31 | <meta name="viewport" content="width=device-width, initial-scale=0.9, maximum-scale=0.9" /> |
| 32 | |
| 33 | </head> |
| 34 | <body> |
| 35 | |
| 36 | |
| 37 | <div class="document"> |
| 38 | <div class="documentwrapper"> |
| 39 | <div class="bodywrapper"> |
| 40 | <div class="body" role="main"> |
| 41 | |
| 42 | <div class="section" id="algorithms"> |
| 43 | <span id="id1"></span><h1>Algorithms</h1> |
| 44 | <div class="section" id="algorithm-categories"> |
| 45 | <h2>Algorithm categories</h2> |
| 46 | <div class="section" id="PSA_ALG_NONE"> |
| 47 | <span id="c.PSA_ALG_NONE"></span><h3><code class="docutils literal"><span class="pre">PSA_ALG_NONE</span></code> (macro)</h3> |
| 48 | <p>An invalid algorithm identifier value.</p> |
| 49 | <pre class="literal-block"> |
| 50 | #define <a class="reference internal" href="#c.PSA_ALG_NONE" title="PSA_ALG_NONE">PSA_ALG_NONE</a> ((<a class="reference internal" href="attributes.html#c.psa_algorithm_t" title="psa_algorithm_t">psa_algorithm_t</a>)0) |
| 51 | </pre> |
| 52 | <p>Zero is not the encoding of any algorithm.</p> |
| 53 | </div> |
| 54 | <div class="section" id="PSA_ALG_IS_HASH"> |
| 55 | <span id="c.PSA_ALG_IS_HASH"></span><h3><code class="docutils literal"><span class="pre">PSA_ALG_IS_HASH</span></code> (macro)</h3> |
| 56 | <p>Whether the specified algorithm is a hash algorithm.</p> |
| 57 | <pre class="literal-block"> |
| 58 | #define <a class="reference internal" href="#c.PSA_ALG_IS_HASH" title="PSA_ALG_IS_HASH">PSA_ALG_IS_HASH</a>(alg) <em><a class="reference internal" href="../../overview/implementation.html#specification-defined-value"><span class="std std-ref">/* specification-defined value */</span></a></em> |
| 59 | </pre> |
| 60 | <p class="rubric">Parameters</p> |
| 61 | <dl class="docutils"> |
| 62 | <dt> <code class="docutils literal"><span class="pre">alg</span></code></dt> |
| 63 | <dd>An algorithm identifier (value of type <a class="reference internal" href="attributes.html#c.psa_algorithm_t" title="psa_algorithm_t"><code class="xref any c c-type docutils literal"><span class="pre">psa_algorithm_t</span></code></a>).</dd> |
| 64 | </dl> |
| 65 | <p class="rubric">Returns</p> |
| 66 | <p><code class="docutils literal"><span class="pre">1</span></code> if <code class="docutils literal"><span class="pre">alg</span></code> is a hash algorithm, <code class="docutils literal"><span class="pre">0</span></code> otherwise. This macro can return either <code class="docutils literal"><span class="pre">0</span></code> or <code class="docutils literal"><span class="pre">1</span></code> if <code class="docutils literal"><span class="pre">alg</span></code> is not a supported algorithm identifier.</p> |
| 67 | <p class="rubric">Description</p> |
| 68 | <p>See <em><a class="reference internal" href="../ops/hashes.html#hash-algorithms"><span class="std std-ref">Hash algorithms</span></a></em> for a list of defined hash algorithms.</p> |
| 69 | </div> |
| 70 | <div class="section" id="PSA_ALG_IS_MAC"> |
| 71 | <span id="c.PSA_ALG_IS_MAC"></span><h3><code class="docutils literal"><span class="pre">PSA_ALG_IS_MAC</span></code> (macro)</h3> |
| 72 | <p>Whether the specified algorithm is a MAC algorithm.</p> |
| 73 | <pre class="literal-block"> |
| 74 | #define <a class="reference internal" href="#c.PSA_ALG_IS_MAC" title="PSA_ALG_IS_MAC">PSA_ALG_IS_MAC</a>(alg) <em><a class="reference internal" href="../../overview/implementation.html#specification-defined-value"><span class="std std-ref">/* specification-defined value */</span></a></em> |
| 75 | </pre> |
| 76 | <p class="rubric">Parameters</p> |
| 77 | <dl class="docutils"> |
| 78 | <dt> <code class="docutils literal"><span class="pre">alg</span></code></dt> |
| 79 | <dd>An algorithm identifier (value of type <a class="reference internal" href="attributes.html#c.psa_algorithm_t" title="psa_algorithm_t"><code class="xref any c c-type docutils literal"><span class="pre">psa_algorithm_t</span></code></a>).</dd> |
| 80 | </dl> |
| 81 | <p class="rubric">Returns</p> |
| 82 | <p><code class="docutils literal"><span class="pre">1</span></code> if <code class="docutils literal"><span class="pre">alg</span></code> is a MAC algorithm, <code class="docutils literal"><span class="pre">0</span></code> otherwise. This macro can return either <code class="docutils literal"><span class="pre">0</span></code> or <code class="docutils literal"><span class="pre">1</span></code> if <code class="docutils literal"><span class="pre">alg</span></code> is not a supported algorithm identifier.</p> |
| 83 | <p class="rubric">Description</p> |
| 84 | <p>See <em><a class="reference internal" href="../ops/macs.html#mac-algorithms"><span class="std std-ref">MAC algorithms</span></a></em> for a list of defined MAC algorithms.</p> |
| 85 | </div> |
| 86 | <div class="section" id="PSA_ALG_IS_CIPHER"> |
| 87 | <span id="c.PSA_ALG_IS_CIPHER"></span><h3><code class="docutils literal"><span class="pre">PSA_ALG_IS_CIPHER</span></code> (macro)</h3> |
| 88 | <p>Whether the specified algorithm is a symmetric cipher algorithm.</p> |
| 89 | <pre class="literal-block"> |
| 90 | #define <a class="reference internal" href="#c.PSA_ALG_IS_CIPHER" title="PSA_ALG_IS_CIPHER">PSA_ALG_IS_CIPHER</a>(alg) <em><a class="reference internal" href="../../overview/implementation.html#specification-defined-value"><span class="std std-ref">/* specification-defined value */</span></a></em> |
| 91 | </pre> |
| 92 | <p class="rubric">Parameters</p> |
| 93 | <dl class="docutils"> |
| 94 | <dt> <code class="docutils literal"><span class="pre">alg</span></code></dt> |
| 95 | <dd>An algorithm identifier (value of type <a class="reference internal" href="attributes.html#c.psa_algorithm_t" title="psa_algorithm_t"><code class="xref any c c-type docutils literal"><span class="pre">psa_algorithm_t</span></code></a>).</dd> |
| 96 | </dl> |
| 97 | <p class="rubric">Returns</p> |
| 98 | <p><code class="docutils literal"><span class="pre">1</span></code> if <code class="docutils literal"><span class="pre">alg</span></code> is a symmetric cipher algorithm, <code class="docutils literal"><span class="pre">0</span></code> otherwise. This macro can return either <code class="docutils literal"><span class="pre">0</span></code> or <code class="docutils literal"><span class="pre">1</span></code> if <code class="docutils literal"><span class="pre">alg</span></code> is not a supported algorithm identifier.</p> |
| 99 | <p class="rubric">Description</p> |
| 100 | <p>See <em><a class="reference internal" href="../ops/ciphers.html#cipher-algorithms"><span class="std std-ref">Cipher algorithms</span></a></em> for a list of defined cipher algorithms.</p> |
| 101 | </div> |
| 102 | <div class="section" id="PSA_ALG_IS_AEAD"> |
| 103 | <span id="c.PSA_ALG_IS_AEAD"></span><h3><code class="docutils literal"><span class="pre">PSA_ALG_IS_AEAD</span></code> (macro)</h3> |
| 104 | <p>Whether the specified algorithm is an authenticated encryption with associated data (AEAD) algorithm.</p> |
| 105 | <pre class="literal-block"> |
| 106 | #define <a class="reference internal" href="#c.PSA_ALG_IS_AEAD" title="PSA_ALG_IS_AEAD">PSA_ALG_IS_AEAD</a>(alg) <em><a class="reference internal" href="../../overview/implementation.html#specification-defined-value"><span class="std std-ref">/* specification-defined value */</span></a></em> |
| 107 | </pre> |
| 108 | <p class="rubric">Parameters</p> |
| 109 | <dl class="docutils"> |
| 110 | <dt> <code class="docutils literal"><span class="pre">alg</span></code></dt> |
| 111 | <dd>An algorithm identifier (value of type <a class="reference internal" href="attributes.html#c.psa_algorithm_t" title="psa_algorithm_t"><code class="xref any c c-type docutils literal"><span class="pre">psa_algorithm_t</span></code></a>).</dd> |
| 112 | </dl> |
| 113 | <p class="rubric">Returns</p> |
| 114 | <p><code class="docutils literal"><span class="pre">1</span></code> if <code class="docutils literal"><span class="pre">alg</span></code> is an AEAD algorithm, <code class="docutils literal"><span class="pre">0</span></code> otherwise. This macro can return either <code class="docutils literal"><span class="pre">0</span></code> or <code class="docutils literal"><span class="pre">1</span></code> if <code class="docutils literal"><span class="pre">alg</span></code> is not a supported algorithm identifier.</p> |
| 115 | <p class="rubric">Description</p> |
| 116 | <p>See <em><a class="reference internal" href="../ops/aead.html#aead-algorithms"><span class="std std-ref">AEAD algorithms</span></a></em> for a list of defined AEAD algorithms.</p> |
| 117 | </div> |
| 118 | <div class="section" id="PSA_ALG_IS_SIGN"> |
| 119 | <span id="c.PSA_ALG_IS_SIGN"></span><h3><code class="docutils literal"><span class="pre">PSA_ALG_IS_SIGN</span></code> (macro)</h3> |
| 120 | <p>Whether the specified algorithm is a public-key signature algorithm.</p> |
| 121 | <pre class="literal-block"> |
| 122 | #define <a class="reference internal" href="#c.PSA_ALG_IS_SIGN" title="PSA_ALG_IS_SIGN">PSA_ALG_IS_SIGN</a>(alg) <em><a class="reference internal" href="../../overview/implementation.html#specification-defined-value"><span class="std std-ref">/* specification-defined value */</span></a></em> |
| 123 | </pre> |
| 124 | <p class="rubric">Parameters</p> |
| 125 | <dl class="docutils"> |
| 126 | <dt> <code class="docutils literal"><span class="pre">alg</span></code></dt> |
| 127 | <dd>An algorithm identifier (value of type <a class="reference internal" href="attributes.html#c.psa_algorithm_t" title="psa_algorithm_t"><code class="xref any c c-type docutils literal"><span class="pre">psa_algorithm_t</span></code></a>).</dd> |
| 128 | </dl> |
| 129 | <p class="rubric">Returns</p> |
| 130 | <p><code class="docutils literal"><span class="pre">1</span></code> if <code class="docutils literal"><span class="pre">alg</span></code> is a public-key signature algorithm, <code class="docutils literal"><span class="pre">0</span></code> otherwise. This macro can return either <code class="docutils literal"><span class="pre">0</span></code> or <code class="docutils literal"><span class="pre">1</span></code> if <code class="docutils literal"><span class="pre">alg</span></code> is not a supported algorithm identifier.</p> |
| 131 | <p class="rubric">Description</p> |
| 132 | <p>See <em><a class="reference internal" href="../ops/sign.html#sign-algorithms"><span class="std std-ref">Asymmetric signature algorithms</span></a></em> for a list of defined signature algorithms.</p> |
| 133 | </div> |
| 134 | <div class="section" id="PSA_ALG_IS_ASYMMETRIC_ENCRYPTION"> |
| 135 | <span id="c.PSA_ALG_IS_ASYMMETRIC_ENCRYPTION"></span><h3><code class="docutils literal"><span class="pre">PSA_ALG_IS_ASYMMETRIC_ENCRYPTION</span></code> (macro)</h3> |
| 136 | <p>Whether the specified algorithm is a public-key encryption algorithm.</p> |
| 137 | <pre class="literal-block"> |
| 138 | #define <a class="reference internal" href="#c.PSA_ALG_IS_ASYMMETRIC_ENCRYPTION" title="PSA_ALG_IS_ASYMMETRIC_ENCRYPTION">PSA_ALG_IS_ASYMMETRIC_ENCRYPTION</a>(alg) <em><a class="reference internal" href="../../overview/implementation.html#specification-defined-value"><span class="std std-ref">/* specification-defined value */</span></a></em> |
| 139 | </pre> |
| 140 | <p class="rubric">Parameters</p> |
| 141 | <dl class="docutils"> |
| 142 | <dt> <code class="docutils literal"><span class="pre">alg</span></code></dt> |
| 143 | <dd>An algorithm identifier (value of type <a class="reference internal" href="attributes.html#c.psa_algorithm_t" title="psa_algorithm_t"><code class="xref any c c-type docutils literal"><span class="pre">psa_algorithm_t</span></code></a>).</dd> |
| 144 | </dl> |
| 145 | <p class="rubric">Returns</p> |
| 146 | <p><code class="docutils literal"><span class="pre">1</span></code> if <code class="docutils literal"><span class="pre">alg</span></code> is a public-key encryption algorithm, <code class="docutils literal"><span class="pre">0</span></code> otherwise. This macro can return either <code class="docutils literal"><span class="pre">0</span></code> or <code class="docutils literal"><span class="pre">1</span></code> if <code class="docutils literal"><span class="pre">alg</span></code> is not a supported algorithm identifier.</p> |
| 147 | <p class="rubric">Description</p> |
| 148 | <p>See <em><a class="reference internal" href="../ops/pke.html#asymmetric-encryption-algorithms"><span class="std std-ref">Asymmetric encryption algorithms</span></a></em> for a list of defined asymmetric encryption algorithms.</p> |
| 149 | </div> |
| 150 | <div class="section" id="PSA_ALG_IS_KEY_AGREEMENT"> |
| 151 | <span id="c.PSA_ALG_IS_KEY_AGREEMENT"></span><h3><code class="docutils literal"><span class="pre">PSA_ALG_IS_KEY_AGREEMENT</span></code> (macro)</h3> |
| 152 | <p>Whether the specified algorithm is a key agreement algorithm.</p> |
| 153 | <pre class="literal-block"> |
| 154 | #define <a class="reference internal" href="#c.PSA_ALG_IS_KEY_AGREEMENT" title="PSA_ALG_IS_KEY_AGREEMENT">PSA_ALG_IS_KEY_AGREEMENT</a>(alg) <em><a class="reference internal" href="../../overview/implementation.html#specification-defined-value"><span class="std std-ref">/* specification-defined value */</span></a></em> |
| 155 | </pre> |
| 156 | <p class="rubric">Parameters</p> |
| 157 | <dl class="docutils"> |
| 158 | <dt> <code class="docutils literal"><span class="pre">alg</span></code></dt> |
| 159 | <dd>An algorithm identifier (value of type <a class="reference internal" href="attributes.html#c.psa_algorithm_t" title="psa_algorithm_t"><code class="xref any c c-type docutils literal"><span class="pre">psa_algorithm_t</span></code></a>).</dd> |
| 160 | </dl> |
| 161 | <p class="rubric">Returns</p> |
| 162 | <p><code class="docutils literal"><span class="pre">1</span></code> if <code class="docutils literal"><span class="pre">alg</span></code> is a key agreement algorithm, <code class="docutils literal"><span class="pre">0</span></code> otherwise. This macro can return either <code class="docutils literal"><span class="pre">0</span></code> or <code class="docutils literal"><span class="pre">1</span></code> if <code class="docutils literal"><span class="pre">alg</span></code> is not a supported algorithm identifier.</p> |
| 163 | <p class="rubric">Description</p> |
| 164 | <p>See <em><a class="reference internal" href="../ops/ka.html#key-agreement-algorithms"><span class="std std-ref">Key agreement algorithms</span></a></em> for a list of defined key agreement algorithms.</p> |
| 165 | </div> |
| 166 | <div class="section" id="PSA_ALG_IS_KEY_DERIVATION"> |
| 167 | <span id="c.PSA_ALG_IS_KEY_DERIVATION"></span><h3><code class="docutils literal"><span class="pre">PSA_ALG_IS_KEY_DERIVATION</span></code> (macro)</h3> |
| 168 | <p>Whether the specified algorithm is a key derivation algorithm.</p> |
| 169 | <pre class="literal-block"> |
| 170 | #define <a class="reference internal" href="#c.PSA_ALG_IS_KEY_DERIVATION" title="PSA_ALG_IS_KEY_DERIVATION">PSA_ALG_IS_KEY_DERIVATION</a>(alg) <em><a class="reference internal" href="../../overview/implementation.html#specification-defined-value"><span class="std std-ref">/* specification-defined value */</span></a></em> |
| 171 | </pre> |
| 172 | <p class="rubric">Parameters</p> |
| 173 | <dl class="docutils"> |
| 174 | <dt> <code class="docutils literal"><span class="pre">alg</span></code></dt> |
| 175 | <dd>An algorithm identifier (value of type <a class="reference internal" href="attributes.html#c.psa_algorithm_t" title="psa_algorithm_t"><code class="xref any c c-type docutils literal"><span class="pre">psa_algorithm_t</span></code></a>).</dd> |
| 176 | </dl> |
| 177 | <p class="rubric">Returns</p> |
| 178 | <p><code class="docutils literal"><span class="pre">1</span></code> if <code class="docutils literal"><span class="pre">alg</span></code> is a key derivation algorithm, <code class="docutils literal"><span class="pre">0</span></code> otherwise. This macro can return either <code class="docutils literal"><span class="pre">0</span></code> or <code class="docutils literal"><span class="pre">1</span></code> if <code class="docutils literal"><span class="pre">alg</span></code> is not a supported algorithm identifier.</p> |
| 179 | <p class="rubric">Description</p> |
| 180 | <p>See <em><a class="reference internal" href="../ops/kdf.html#key-derivation-algorithms"><span class="std std-ref">Key derivation algorithms</span></a></em> for a list of defined key derivation algorithms.</p> |
| 181 | </div> |
| 182 | <div class="section" id="PSA_ALG_IS_WILDCARD"> |
| 183 | <span id="c.PSA_ALG_IS_WILDCARD"></span><h3><code class="docutils literal"><span class="pre">PSA_ALG_IS_WILDCARD</span></code> (macro)</h3> |
| 184 | <p>Whether the specified algorithm encoding is a wildcard.</p> |
| 185 | <pre class="literal-block"> |
| 186 | #define <a class="reference internal" href="#c.PSA_ALG_IS_WILDCARD" title="PSA_ALG_IS_WILDCARD">PSA_ALG_IS_WILDCARD</a>(alg) <em><a class="reference internal" href="../../overview/implementation.html#specification-defined-value"><span class="std std-ref">/* specification-defined value */</span></a></em> |
| 187 | </pre> |
| 188 | <p class="rubric">Parameters</p> |
| 189 | <dl class="docutils"> |
| 190 | <dt> <code class="docutils literal"><span class="pre">alg</span></code></dt> |
| 191 | <dd>An algorithm identifier (value of type <a class="reference internal" href="attributes.html#c.psa_algorithm_t" title="psa_algorithm_t"><code class="xref any c c-type docutils literal"><span class="pre">psa_algorithm_t</span></code></a>).</dd> |
| 192 | </dl> |
| 193 | <p class="rubric">Returns</p> |
| 194 | <p><code class="docutils literal"><span class="pre">1</span></code> if <code class="docutils literal"><span class="pre">alg</span></code> is a wildcard algorithm encoding.</p> |
| 195 | <p><code class="docutils literal"><span class="pre">0</span></code> if <code class="docutils literal"><span class="pre">alg</span></code> is a non-wildcard algorithm encoding that is suitable for an operation.</p> |
| 196 | <p>This macro can return either <code class="docutils literal"><span class="pre">0</span></code> or <code class="docutils literal"><span class="pre">1</span></code> if <code class="docutils literal"><span class="pre">alg</span></code> is not a supported algorithm identifier.</p> |
| 197 | <p class="rubric">Description</p> |
| 198 | <p>Wildcard algorithm values can only be used to set the usage algorithm field in a policy, wildcard values cannot be used to perform an operation.</p> |
| 199 | <p>See <a class="reference internal" href="../ops/sign.html#c.PSA_ALG_ANY_HASH" title="PSA_ALG_ANY_HASH"><code class="xref any c c-macro docutils literal"><span class="pre">PSA_ALG_ANY_HASH</span></code></a> for example of how a wildcard algorithm can be used in a key policy.</p> |
| 200 | </div> |
| 201 | <div class="section" id="PSA_ALG_GET_HASH"> |
| 202 | <span id="c.PSA_ALG_GET_HASH"></span><h3><code class="docutils literal"><span class="pre">PSA_ALG_GET_HASH</span></code> (macro)</h3> |
| 203 | <p>Get the hash used by a composite algorithm.</p> |
| 204 | <pre class="literal-block"> |
| 205 | #define <a class="reference internal" href="#c.PSA_ALG_GET_HASH" title="PSA_ALG_GET_HASH">PSA_ALG_GET_HASH</a>(alg) <em><a class="reference internal" href="../../overview/implementation.html#specification-defined-value"><span class="std std-ref">/* specification-defined value */</span></a></em> |
| 206 | </pre> |
| 207 | <p class="rubric">Parameters</p> |
| 208 | <dl class="docutils"> |
| 209 | <dt> <code class="docutils literal"><span class="pre">alg</span></code></dt> |
| 210 | <dd>An algorithm identifier (value of type <a class="reference internal" href="attributes.html#c.psa_algorithm_t" title="psa_algorithm_t"><code class="xref any c c-type docutils literal"><span class="pre">psa_algorithm_t</span></code></a>).</dd> |
| 211 | </dl> |
| 212 | <p class="rubric">Returns</p> |
| 213 | <p>The underlying hash algorithm if <code class="docutils literal"><span class="pre">alg</span></code> is a composite algorithm that uses a hash algorithm.</p> |
| 214 | <p><a class="reference internal" href="#c.PSA_ALG_NONE" title="PSA_ALG_NONE"><code class="xref any c c-macro docutils literal"><span class="pre">PSA_ALG_NONE</span></code></a> if <code class="docutils literal"><span class="pre">alg</span></code> is not a composite algorithm that uses a hash.</p> |
| 215 | <p class="rubric">Description</p> |
| 216 | <p>The following composite algorithms require a hash algorithm:</p> |
| 217 | <ul class="simple"> |
| 218 | <li><a class="reference internal" href="../ops/sign.html#c.PSA_ALG_ECDSA" title="PSA_ALG_ECDSA"><code class="xref any c c-macro docutils literal"><span class="pre">PSA_ALG_ECDSA()</span></code></a></li> |
| 219 | <li><a class="reference internal" href="../ops/kdf.html#c.PSA_ALG_HKDF" title="PSA_ALG_HKDF"><code class="xref any c c-macro docutils literal"><span class="pre">PSA_ALG_HKDF()</span></code></a></li> |
| 220 | <li><a class="reference internal" href="../ops/macs.html#c.PSA_ALG_HMAC" title="PSA_ALG_HMAC"><code class="xref any c c-macro docutils literal"><span class="pre">PSA_ALG_HMAC()</span></code></a></li> |
| 221 | <li><a class="reference internal" href="../ops/pke.html#c.PSA_ALG_RSA_OAEP" title="PSA_ALG_RSA_OAEP"><code class="xref any c c-macro docutils literal"><span class="pre">PSA_ALG_RSA_OAEP()</span></code></a></li> |
| 222 | <li><a class="reference internal" href="../ops/sign.html#c.PSA_ALG_IS_RSA_PKCS1V15_SIGN" title="PSA_ALG_IS_RSA_PKCS1V15_SIGN"><code class="xref any c c-macro docutils literal"><span class="pre">PSA_ALG_IS_RSA_PKCS1V15_SIGN()</span></code></a></li> |
| 223 | <li><a class="reference internal" href="../ops/sign.html#c.PSA_ALG_RSA_PSS" title="PSA_ALG_RSA_PSS"><code class="xref any c c-macro docutils literal"><span class="pre">PSA_ALG_RSA_PSS()</span></code></a></li> |
| 224 | <li><a class="reference internal" href="../ops/kdf.html#c.PSA_ALG_TLS12_PRF" title="PSA_ALG_TLS12_PRF"><code class="xref any c c-macro docutils literal"><span class="pre">PSA_ALG_TLS12_PRF()</span></code></a></li> |
| 225 | <li><a class="reference internal" href="../ops/kdf.html#c.PSA_ALG_TLS12_PSK_TO_MS" title="PSA_ALG_TLS12_PSK_TO_MS"><code class="xref any c c-macro docutils literal"><span class="pre">PSA_ALG_TLS12_PSK_TO_MS()</span></code></a></li> |
| 226 | </ul> |
| 227 | </div> |
| 228 | </div> |
| 229 | <div class="section" id="attribute-accessors"> |
| 230 | <h2>Attribute accessors</h2> |
| 231 | <div class="section" id="psa_set_key_algorithm"> |
| 232 | <span id="c.psa_set_key_algorithm"></span><h3><code class="docutils literal"><span class="pre">psa_set_key_algorithm</span></code> (function)</h3> |
| 233 | <p>Declare the permitted algorithm policy for a key.</p> |
| 234 | <pre class="literal-block"> |
| 235 | void <a class="reference internal" href="#c.psa_set_key_algorithm" title="psa_set_key_algorithm">psa_set_key_algorithm</a>(<a class="reference internal" href="attributes.html#c.psa_key_attributes_t" title="psa_key_attributes_t">psa_key_attributes_t</a> * attributes, |
| 236 | <a class="reference internal" href="attributes.html#c.psa_algorithm_t" title="psa_algorithm_t">psa_algorithm_t</a> alg); |
| 237 | </pre> |
| 238 | <p class="rubric">Parameters</p> |
| 239 | <dl class="docutils"> |
| 240 | <dt> <code class="docutils literal"><span class="pre">attributes</span></code></dt> |
| 241 | <dd>The attribute object to write to.</dd> |
| 242 | <dt> <code class="docutils literal"><span class="pre">alg</span></code></dt> |
| 243 | <dd>The permitted algorithm policy to write.</dd> |
| 244 | </dl> |
| 245 | <p class="rubric">Returns: <code class="docutils literal"><span class="pre">void</span></code></p> |
| 246 | <p class="rubric">Description</p> |
| 247 | <p>The permitted algorithm policy of a key encodes which algorithm or algorithms are permitted to be used with this key. The following algorithm policies are supported:</p> |
| 248 | <ul class="simple"> |
| 249 | <li><a class="reference internal" href="#c.PSA_ALG_NONE" title="PSA_ALG_NONE"><code class="xref any c c-macro docutils literal"><span class="pre">PSA_ALG_NONE</span></code></a> does not allow any cryptographic operation with the key. The key can still be used for non-cryptographic actions such as exporting, if permitted by the usage flags.</li> |
| 250 | <li>An algorithm value permits this particular algorithm.</li> |
| 251 | <li>An algorithm wildcard built from <a class="reference internal" href="../ops/sign.html#c.PSA_ALG_ANY_HASH" title="PSA_ALG_ANY_HASH"><code class="xref any c c-macro docutils literal"><span class="pre">PSA_ALG_ANY_HASH</span></code></a> allows the specified signature scheme with any hash algorithm.</li> |
| 252 | </ul> |
| 253 | <p>This function overwrites any algorithm policy previously set in <code class="docutils literal"><span class="pre">attributes</span></code>.</p> |
| 254 | <div class="admonition-implementation-note admonition"> |
| 255 | <p class="first admonition-title">Implementation note</p> |
| 256 | <p>This is a simple accessor function that is not required to validate its inputs. The following approaches can be used to provide an efficient implementation:</p> |
| 257 | <ul class="last simple"> |
| 258 | <li>This function can be declared as <code class="docutils literal"><span class="pre">static</span></code> or <code class="docutils literal"><span class="pre">inline</span></code>, instead of using the default external linkage.</li> |
| 259 | <li>This function can be provided as a function-like macro. In this form, the macro must evaluate each of its arguments exactly once, as if it was a function call.</li> |
| 260 | </ul> |
| 261 | </div> |
| 262 | </div> |
| 263 | <div class="section" id="psa_get_key_algorithm"> |
| 264 | <span id="c.psa_get_key_algorithm"></span><h3><code class="docutils literal"><span class="pre">psa_get_key_algorithm</span></code> (function)</h3> |
| 265 | <p>Retrieve the algorithm policy from key attributes.</p> |
| 266 | <pre class="literal-block"> |
| 267 | <a class="reference internal" href="attributes.html#c.psa_algorithm_t" title="psa_algorithm_t">psa_algorithm_t</a> <a class="reference internal" href="#c.psa_get_key_algorithm" title="psa_get_key_algorithm">psa_get_key_algorithm</a>(const <a class="reference internal" href="attributes.html#c.psa_key_attributes_t" title="psa_key_attributes_t">psa_key_attributes_t</a> * attributes); |
| 268 | </pre> |
| 269 | <p class="rubric">Parameters</p> |
| 270 | <dl class="docutils"> |
| 271 | <dt> <code class="docutils literal"><span class="pre">attributes</span></code></dt> |
| 272 | <dd>The key attribute object to query.</dd> |
| 273 | </dl> |
| 274 | <p class="rubric">Returns: <a class="reference internal" href="attributes.html#c.psa_algorithm_t" title="psa_algorithm_t"><code class="docutils literal"><span class="pre">psa_algorithm_t</span></code></a></p> |
| 275 | <p>The algorithm stored in the attribute object.</p> |
| 276 | <p class="rubric">Description</p> |
| 277 | <div class="admonition-implementation-note admonition"> |
| 278 | <p class="first admonition-title">Implementation note</p> |
| 279 | <p>This is a simple accessor function that is not required to validate its inputs. The following approaches can be used to provide an efficient implementation:</p> |
| 280 | <ul class="last simple"> |
| 281 | <li>This function can be declared as <code class="docutils literal"><span class="pre">static</span></code> or <code class="docutils literal"><span class="pre">inline</span></code>, instead of using the default external linkage.</li> |
| 282 | <li>This function can be provided as a function-like macro. In this form, the macro must evaluate each of its arguments exactly once, as if it was a function call.</li> |
| 283 | </ul> |
| 284 | </div> |
| 285 | </div> |
| 286 | </div> |
| 287 | </div> |
| 288 | |
| 289 | |
| 290 | </div> |
| 291 | </div> |
| 292 | </div> |
| 293 | <div class="sphinxsidebar" role="navigation" aria-label="main navigation"> |
| 294 | <div class="sphinxsidebarwrapper"> |
| 295 | <h3><a href="../../index.html">Table Of Contents</a></h3> |
| 296 | <ul> |
| 297 | <li><a class="reference internal" href="#">Algorithms</a><ul> |
| 298 | <li><a class="reference internal" href="#algorithm-categories">Algorithm categories</a><ul> |
| 299 | <li><a class="reference internal" href="#PSA_ALG_NONE"><code class="docutils literal"><span class="pre">PSA_ALG_NONE</span></code> (macro)</a></li> |
| 300 | <li><a class="reference internal" href="#PSA_ALG_IS_HASH"><code class="docutils literal"><span class="pre">PSA_ALG_IS_HASH</span></code> (macro)</a></li> |
| 301 | <li><a class="reference internal" href="#PSA_ALG_IS_MAC"><code class="docutils literal"><span class="pre">PSA_ALG_IS_MAC</span></code> (macro)</a></li> |
| 302 | <li><a class="reference internal" href="#PSA_ALG_IS_CIPHER"><code class="docutils literal"><span class="pre">PSA_ALG_IS_CIPHER</span></code> (macro)</a></li> |
| 303 | <li><a class="reference internal" href="#PSA_ALG_IS_AEAD"><code class="docutils literal"><span class="pre">PSA_ALG_IS_AEAD</span></code> (macro)</a></li> |
| 304 | <li><a class="reference internal" href="#PSA_ALG_IS_SIGN"><code class="docutils literal"><span class="pre">PSA_ALG_IS_SIGN</span></code> (macro)</a></li> |
| 305 | <li><a class="reference internal" href="#PSA_ALG_IS_ASYMMETRIC_ENCRYPTION"><code class="docutils literal"><span class="pre">PSA_ALG_IS_ASYMMETRIC_ENCRYPTION</span></code> (macro)</a></li> |
| 306 | <li><a class="reference internal" href="#PSA_ALG_IS_KEY_AGREEMENT"><code class="docutils literal"><span class="pre">PSA_ALG_IS_KEY_AGREEMENT</span></code> (macro)</a></li> |
| 307 | <li><a class="reference internal" href="#PSA_ALG_IS_KEY_DERIVATION"><code class="docutils literal"><span class="pre">PSA_ALG_IS_KEY_DERIVATION</span></code> (macro)</a></li> |
| 308 | <li><a class="reference internal" href="#PSA_ALG_IS_WILDCARD"><code class="docutils literal"><span class="pre">PSA_ALG_IS_WILDCARD</span></code> (macro)</a></li> |
| 309 | <li><a class="reference internal" href="#PSA_ALG_GET_HASH"><code class="docutils literal"><span class="pre">PSA_ALG_GET_HASH</span></code> (macro)</a></li> |
| 310 | </ul> |
| 311 | </li> |
| 312 | <li><a class="reference internal" href="#attribute-accessors">Attribute accessors</a><ul> |
| 313 | <li><a class="reference internal" href="#psa_set_key_algorithm"><code class="docutils literal"><span class="pre">psa_set_key_algorithm</span></code> (function)</a></li> |
| 314 | <li><a class="reference internal" href="#psa_get_key_algorithm"><code class="docutils literal"><span class="pre">psa_get_key_algorithm</span></code> (function)</a></li> |
| 315 | </ul> |
| 316 | </li> |
| 317 | </ul> |
| 318 | </li> |
| 319 | </ul> |
| 320 | <div class="relations"> |
| 321 | <h3>Related Topics</h3> |
| 322 | <ul> |
| 323 | <li><a href="../../index.html">Documentation overview</a><ul> |
| 324 | <li><a href="index.html">Key management reference</a><ul> |
| 325 | <li>Previous: <a href="usage.html" title="previous chapter">Key policies</a></li> |
| 326 | <li>Next: <a href="management.html" title="next chapter">Key management functions</a></li> |
| 327 | </ul></li> |
| 328 | </ul></li> |
| 329 | </ul> |
| 330 | </div> |
| 331 | <div role="note" aria-label="source link"> |
| 332 | <h3>This Page</h3> |
| 333 | <ul class="this-page-menu"> |
| 334 | <li><a href="../../_sources/api/keys/algorithms.rst.txt" |
| 335 | rel="nofollow">Show Source</a></li> |
| 336 | </ul> |
| 337 | </div> |
| 338 | <div id="searchbox" style="display: none" role="search"> |
| 339 | <h3>Quick search</h3> |
| 340 | <form class="search" action="../../search.html" method="get"> |
| 341 | <div><input type="text" name="q" /></div> |
| 342 | <div><input type="submit" value="Go" /></div> |
| 343 | <input type="hidden" name="check_keywords" value="yes" /> |
| 344 | <input type="hidden" name="area" value="default" /> |
| 345 | </form> |
| 346 | </div> |
| 347 | <script type="text/javascript">$('#searchbox').show(0);</script> |
| 348 | </div> |
| 349 | </div> |
| 350 | <div class="clearer"></div> |
| 351 | </div> |
| 352 | <div class="footer"> |
| 353 | © 2019-2020, Arm Limited or its affiliates. All rights reserved. |
| 354 | |
| 355 | | |
| 356 | Powered by <a href="http://sphinx-doc.org/">Sphinx 1.6.7</a> |
| 357 | & <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.8</a> |
| 358 | |
| 359 | | |
| 360 | <a href="../../_sources/api/keys/algorithms.rst.txt" |
| 361 | rel="nofollow">Page source</a> |
| 362 | </div> |
| 363 | |
| 364 | |
| 365 | |
| 366 | |
| 367 | </body> |
| 368 | </html> |