Gilles Peskine | c2db5f0 | 2021-01-18 20:36:53 +0100 | [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>10.1. Algorithms — PSA Crypto API 1.0.1 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.1', |
| 15 | COLLAPSE_INDEX: false, |
| 16 | FILE_SUFFIX: '.html', |
| 17 | HAS_SOURCE: false, |
| 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="author" title="About these documents" href="../../about.html" /> |
| 25 | <link rel="index" title="Index" href="../../genindex.html" /> |
| 26 | <link rel="search" title="Search" href="../../search.html" /> |
| 27 | <link rel="next" title="10.2. Message digests" href="hashes.html" /> |
| 28 | <link rel="prev" title="10. Cryptographic operation reference" href="index.html" /> |
| 29 | |
| 30 | <link rel="stylesheet" href="../../_static/custom.css" type="text/css" /> |
| 31 | |
| 32 | <meta name="viewport" content="width=device-width, initial-scale=0.9, maximum-scale=0.9" /> |
| 33 | |
| 34 | </head> |
| 35 | <body> |
| 36 | |
| 37 | |
| 38 | <div class="document"> |
| 39 | <div class="documentwrapper"> |
| 40 | <div class="bodywrapper"> |
| 41 | <div class="body" role="main"> |
| 42 | |
| 43 | <div class="section" id="algorithms"> |
| 44 | <span id="id1"></span><h1>10.1. Algorithms</h1> |
| 45 | <p>This specification encodes algorithms into a structured 32-bit integer value.</p> |
| 46 | <p>Algorithm identifiers are used for two purposes in this API:</p> |
| 47 | <ol class="arabic simple"> |
| 48 | <li>To specify a specific algorithm to use in a cryptographic operation. These are all defined in <a class="reference internal" href="index.html#crypto-operations"><span class="secref">Cryptographic operation reference</span></a>.</li> |
| 49 | <li>To specify the policy for a key, identifying the permitted algorithm for use with the key. This use is described in <a class="reference internal" href="../keys/policy.html#key-policy"><span class="secref">Key policies</span></a>.</li> |
| 50 | </ol> |
| 51 | <p>The specific algorithm identifiers are described alongside the cryptographic operation functions to which they apply:</p> |
| 52 | <ul class="simple"> |
| 53 | <li><a class="reference internal" href="hashes.html#hash-algorithms"><span class="secref">Hash algorithms</span></a></li> |
| 54 | <li><a class="reference internal" href="macs.html#mac-algorithms"><span class="secref">MAC algorithms</span></a></li> |
| 55 | <li><a class="reference internal" href="ciphers.html#cipher-algorithms"><span class="secref">Cipher algorithms</span></a></li> |
| 56 | <li><a class="reference internal" href="aead.html#aead-algorithms"><span class="secref">AEAD algorithms</span></a></li> |
| 57 | <li><a class="reference internal" href="kdf.html#key-derivation-algorithms"><span class="secref">Key derivation algorithms</span></a></li> |
| 58 | <li><a class="reference internal" href="sign.html#sign-algorithms"><span class="secref">Asymmetric signature algorithms</span></a></li> |
| 59 | <li><a class="reference internal" href="pke.html#asymmetric-encryption-algorithms"><span class="secref">Asymmetric encryption algorithms</span></a></li> |
| 60 | <li><a class="reference internal" href="ka.html#key-agreement-algorithms"><span class="secref">Key agreement algorithms</span></a></li> |
| 61 | </ul> |
| 62 | <div class="section" id="algorithm-encoding"> |
| 63 | <h2>10.1.1. Algorithm encoding</h2> |
| 64 | <div class="section" id="psa_algorithm_t"> |
| 65 | <span id="c.psa_algorithm_t"></span><h3><code class="docutils literal"><span class="pre">psa_algorithm_t</span></code> (type)</h3> |
| 66 | <p>Encoding of a cryptographic algorithm.</p> |
| 67 | <pre class="literal-block"> |
| 68 | typedef uint32_t <a class="reference internal" href="#c.psa_algorithm_t" title="psa_algorithm_t">psa_algorithm_t</a>; |
| 69 | </pre> |
| 70 | <p>This is a structured bitfield that identifies the category and type of algorithm. The range of algorithm identifier values is divided as follows:</p> |
| 71 | <dl class="docutils"> |
| 72 | <dt><code class="docutils literal"><span class="pre">0</span></code><code class="docutils literal"><span class="pre">x00000000</span></code></dt> |
| 73 | <dd>Reserved as an invalid algorithm identifier.</dd> |
| 74 | <dt><code class="docutils literal"><span class="pre">0</span></code><code class="docutils literal"><span class="pre">x00000001</span></code><code class="docutils literal"> <span class="pre">-</span> <span class="pre">0</span></code><code class="docutils literal"><span class="pre">x7fffffff</span></code></dt> |
| 75 | <dd>Specification-defined algorithm identifiers. |
| 76 | Algorithm identifiers defined by this standard always have bit 31 clear. |
| 77 | Unallocated algorithm identifier values in this range are reserved for future use.</dd> |
| 78 | <dt><code class="docutils literal"><span class="pre">0</span></code><code class="docutils literal"><span class="pre">x80000000</span></code><code class="docutils literal"> <span class="pre">-</span> <span class="pre">0</span></code><code class="docutils literal"><span class="pre">xffffffff</span></code></dt> |
| 79 | <dd>Implementation-defined algorithm identifiers. |
| 80 | Implementations that define additional algorithms must use an encoding with bit 31 set. |
| 81 | The related support macros will be easier to write if these algorithm identifier encodings also respect the bitwise structure used by standard encodings.</dd> |
| 82 | </dl> |
| 83 | <p>For algorithms that can be applied to multiple key types, this identifier does not encode the key type. For example, for symmetric ciphers based on a block cipher, <a class="reference internal" href="#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> encodes the block cipher mode and the padding mode while the block cipher itself is encoded via <a class="reference internal" href="../keys/types.html#c.psa_key_type_t" title="psa_key_type_t"><code class="xref any c c-type docutils literal"><span class="pre">psa_key_type_t</span></code></a>.</p> |
| 84 | </div> |
| 85 | <div class="section" id="PSA_ALG_NONE"> |
| 86 | <span id="c.PSA_ALG_NONE"></span><h3><code class="docutils literal"><span class="pre">PSA_ALG_NONE</span></code> (macro)</h3> |
| 87 | <p>An invalid algorithm identifier value.</p> |
| 88 | <pre class="literal-block"> |
| 89 | #define <a class="reference internal" href="#c.PSA_ALG_NONE" title="PSA_ALG_NONE">PSA_ALG_NONE</a> ((<a class="reference internal" href="#c.psa_algorithm_t" title="psa_algorithm_t">psa_algorithm_t</a>)0) |
| 90 | </pre> |
| 91 | <p>Zero is not the encoding of any algorithm.</p> |
| 92 | </div> |
| 93 | </div> |
| 94 | <div class="section" id="algorithm-categories"> |
| 95 | <h2>10.1.2. Algorithm categories</h2> |
| 96 | <div class="section" id="PSA_ALG_IS_HASH"> |
| 97 | <span id="c.PSA_ALG_IS_HASH"></span><h3><code class="docutils literal"><span class="pre">PSA_ALG_IS_HASH</span></code> (macro)</h3> |
| 98 | <p>Whether the specified algorithm is a hash algorithm.</p> |
| 99 | <pre class="literal-block"> |
| 100 | #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> |
| 101 | </pre> |
| 102 | <p class="rubric">Parameters</p> |
| 103 | <dl class="docutils"> |
| 104 | <dt> <code class="docutils literal"><span class="pre">alg</span></code></dt> |
| 105 | <dd>An algorithm identifier (value of type <a class="reference internal" href="#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> |
| 106 | </dl> |
| 107 | <p class="rubric">Returns</p> |
| 108 | <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> |
| 109 | <p class="rubric">Description</p> |
| 110 | <p>See <a class="reference internal" href="hashes.html#hash-algorithms"><span class="secref">Hash algorithms</span></a> for a list of defined hash algorithms.</p> |
| 111 | </div> |
| 112 | <div class="section" id="PSA_ALG_IS_MAC"> |
| 113 | <span id="c.PSA_ALG_IS_MAC"></span><h3><code class="docutils literal"><span class="pre">PSA_ALG_IS_MAC</span></code> (macro)</h3> |
| 114 | <p>Whether the specified algorithm is a MAC algorithm.</p> |
| 115 | <pre class="literal-block"> |
| 116 | #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> |
| 117 | </pre> |
| 118 | <p class="rubric">Parameters</p> |
| 119 | <dl class="docutils"> |
| 120 | <dt> <code class="docutils literal"><span class="pre">alg</span></code></dt> |
| 121 | <dd>An algorithm identifier (value of type <a class="reference internal" href="#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> |
| 122 | </dl> |
| 123 | <p class="rubric">Returns</p> |
| 124 | <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> |
| 125 | <p class="rubric">Description</p> |
| 126 | <p>See <a class="reference internal" href="macs.html#mac-algorithms"><span class="secref">MAC algorithms</span></a> for a list of defined MAC algorithms.</p> |
| 127 | </div> |
| 128 | <div class="section" id="PSA_ALG_IS_CIPHER"> |
| 129 | <span id="c.PSA_ALG_IS_CIPHER"></span><h3><code class="docutils literal"><span class="pre">PSA_ALG_IS_CIPHER</span></code> (macro)</h3> |
| 130 | <p>Whether the specified algorithm is a symmetric cipher algorithm.</p> |
| 131 | <pre class="literal-block"> |
| 132 | #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> |
| 133 | </pre> |
| 134 | <p class="rubric">Parameters</p> |
| 135 | <dl class="docutils"> |
| 136 | <dt> <code class="docutils literal"><span class="pre">alg</span></code></dt> |
| 137 | <dd>An algorithm identifier (value of type <a class="reference internal" href="#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> |
| 138 | </dl> |
| 139 | <p class="rubric">Returns</p> |
| 140 | <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> |
| 141 | <p class="rubric">Description</p> |
| 142 | <p>See <a class="reference internal" href="ciphers.html#cipher-algorithms"><span class="secref">Cipher algorithms</span></a> for a list of defined cipher algorithms.</p> |
| 143 | </div> |
| 144 | <div class="section" id="PSA_ALG_IS_AEAD"> |
| 145 | <span id="c.PSA_ALG_IS_AEAD"></span><h3><code class="docutils literal"><span class="pre">PSA_ALG_IS_AEAD</span></code> (macro)</h3> |
| 146 | <p>Whether the specified algorithm is an authenticated encryption with associated data (AEAD) algorithm.</p> |
| 147 | <pre class="literal-block"> |
| 148 | #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> |
| 149 | </pre> |
| 150 | <p class="rubric">Parameters</p> |
| 151 | <dl class="docutils"> |
| 152 | <dt> <code class="docutils literal"><span class="pre">alg</span></code></dt> |
| 153 | <dd>An algorithm identifier (value of type <a class="reference internal" href="#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> |
| 154 | </dl> |
| 155 | <p class="rubric">Returns</p> |
| 156 | <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> |
| 157 | <p class="rubric">Description</p> |
| 158 | <p>See <a class="reference internal" href="aead.html#aead-algorithms"><span class="secref">AEAD algorithms</span></a> for a list of defined AEAD algorithms.</p> |
| 159 | </div> |
| 160 | <div class="section" id="PSA_ALG_IS_SIGN"> |
| 161 | <span id="c.PSA_ALG_IS_SIGN"></span><h3><code class="docutils literal"><span class="pre">PSA_ALG_IS_SIGN</span></code> (macro)</h3> |
| 162 | <p>Whether the specified algorithm is an asymmetric signature algorithm, also known as public-key signature algorithm.</p> |
| 163 | <pre class="literal-block"> |
| 164 | #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> |
| 165 | </pre> |
| 166 | <p class="rubric">Parameters</p> |
| 167 | <dl class="docutils"> |
| 168 | <dt> <code class="docutils literal"><span class="pre">alg</span></code></dt> |
| 169 | <dd>An algorithm identifier (value of type <a class="reference internal" href="#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> |
| 170 | </dl> |
| 171 | <p class="rubric">Returns</p> |
| 172 | <p><code class="docutils literal"><span class="pre">1</span></code> if <code class="docutils literal"><span class="pre">alg</span></code> is an asymmetric 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> |
| 173 | <p class="rubric">Description</p> |
| 174 | <p>See <a class="reference internal" href="sign.html#sign-algorithms"><span class="secref">Asymmetric signature algorithms</span></a> for a list of defined signature algorithms.</p> |
| 175 | </div> |
| 176 | <div class="section" id="PSA_ALG_IS_ASYMMETRIC_ENCRYPTION"> |
| 177 | <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> |
| 178 | <p>Whether the specified algorithm is an asymmetric encryption algorithm, also known as public-key encryption algorithm.</p> |
| 179 | <pre class="literal-block"> |
| 180 | #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> |
| 181 | </pre> |
| 182 | <p class="rubric">Parameters</p> |
| 183 | <dl class="docutils"> |
| 184 | <dt> <code class="docutils literal"><span class="pre">alg</span></code></dt> |
| 185 | <dd>An algorithm identifier (value of type <a class="reference internal" href="#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> |
| 186 | </dl> |
| 187 | <p class="rubric">Returns</p> |
| 188 | <p><code class="docutils literal"><span class="pre">1</span></code> if <code class="docutils literal"><span class="pre">alg</span></code> is an asymmetric 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> |
| 189 | <p class="rubric">Description</p> |
| 190 | <p>See <a class="reference internal" href="pke.html#asymmetric-encryption-algorithms"><span class="secref">Asymmetric encryption algorithms</span></a> for a list of defined asymmetric encryption algorithms.</p> |
| 191 | </div> |
| 192 | <div class="section" id="PSA_ALG_IS_KEY_AGREEMENT"> |
| 193 | <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> |
| 194 | <p>Whether the specified algorithm is a key agreement algorithm.</p> |
| 195 | <pre class="literal-block"> |
| 196 | #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> |
| 197 | </pre> |
| 198 | <p class="rubric">Parameters</p> |
| 199 | <dl class="docutils"> |
| 200 | <dt> <code class="docutils literal"><span class="pre">alg</span></code></dt> |
| 201 | <dd>An algorithm identifier (value of type <a class="reference internal" href="#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> |
| 202 | </dl> |
| 203 | <p class="rubric">Returns</p> |
| 204 | <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> |
| 205 | <p class="rubric">Description</p> |
| 206 | <p>See <a class="reference internal" href="ka.html#key-agreement-algorithms"><span class="secref">Key agreement algorithms</span></a> for a list of defined key agreement algorithms.</p> |
| 207 | </div> |
| 208 | <div class="section" id="PSA_ALG_IS_KEY_DERIVATION"> |
| 209 | <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> |
| 210 | <p>Whether the specified algorithm is a key derivation algorithm.</p> |
| 211 | <pre class="literal-block"> |
| 212 | #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> |
| 213 | </pre> |
| 214 | <p class="rubric">Parameters</p> |
| 215 | <dl class="docutils"> |
| 216 | <dt> <code class="docutils literal"><span class="pre">alg</span></code></dt> |
| 217 | <dd>An algorithm identifier (value of type <a class="reference internal" href="#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> |
| 218 | </dl> |
| 219 | <p class="rubric">Returns</p> |
| 220 | <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> |
| 221 | <p class="rubric">Description</p> |
| 222 | <p>See <a class="reference internal" href="kdf.html#key-derivation-algorithms"><span class="secref">Key derivation algorithms</span></a> for a list of defined key derivation algorithms.</p> |
| 223 | </div> |
| 224 | <div class="section" id="PSA_ALG_IS_WILDCARD"> |
| 225 | <span id="c.PSA_ALG_IS_WILDCARD"></span><h3><code class="docutils literal"><span class="pre">PSA_ALG_IS_WILDCARD</span></code> (macro)</h3> |
| 226 | <p>Whether the specified algorithm encoding is a wildcard.</p> |
| 227 | <pre class="literal-block"> |
| 228 | #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> |
| 229 | </pre> |
| 230 | <p class="rubric">Parameters</p> |
| 231 | <dl class="docutils"> |
| 232 | <dt> <code class="docutils literal"><span class="pre">alg</span></code></dt> |
| 233 | <dd>An algorithm identifier (value of type <a class="reference internal" href="#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> |
| 234 | </dl> |
| 235 | <p class="rubric">Returns</p> |
| 236 | <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> |
| 237 | <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> |
| 238 | <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> |
| 239 | <p class="rubric">Description</p> |
| 240 | <p>Wildcard algorithm values can only be used to set the permitted algorithm field in a key policy, wildcard values cannot be used to perform an operation.</p> |
| 241 | <p>See <a class="reference internal" href="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> |
| 242 | </div> |
| 243 | <div class="section" id="PSA_ALG_GET_HASH"> |
| 244 | <span id="c.PSA_ALG_GET_HASH"></span><h3><code class="docutils literal"><span class="pre">PSA_ALG_GET_HASH</span></code> (macro)</h3> |
| 245 | <p>Get the hash used by a composite algorithm.</p> |
| 246 | <pre class="literal-block"> |
| 247 | #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> |
| 248 | </pre> |
| 249 | <p class="rubric">Parameters</p> |
| 250 | <dl class="docutils"> |
| 251 | <dt> <code class="docutils literal"><span class="pre">alg</span></code></dt> |
| 252 | <dd>An algorithm identifier (value of type <a class="reference internal" href="#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> |
| 253 | </dl> |
| 254 | <p class="rubric">Returns</p> |
| 255 | <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> |
| 256 | <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> |
| 257 | <p class="rubric">Description</p> |
| 258 | <p>The following composite algorithms require a hash algorithm:</p> |
| 259 | <ul class="simple"> |
| 260 | <li><a class="reference internal" href="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> |
| 261 | <li><a class="reference internal" href="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> |
| 262 | <li><a class="reference internal" href="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> |
| 263 | <li><a class="reference internal" href="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> |
| 264 | <li><a class="reference internal" href="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> |
| 265 | <li><a class="reference internal" href="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> |
| 266 | <li><a class="reference internal" href="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> |
| 267 | <li><a class="reference internal" href="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> |
| 268 | </ul> |
| 269 | </div> |
| 270 | </div> |
| 271 | </div> |
| 272 | |
| 273 | |
| 274 | </div> |
| 275 | </div> |
| 276 | </div> |
| 277 | <div class="sphinxsidebar" role="navigation" aria-label="main navigation"> |
| 278 | <div class="sphinxsidebarwrapper"><h3><a href="../../index.html"><b>PSA Crypto API</b></a></h3> |
| 279 | IHI 0086<br/> |
| 280 | Non-confidential<br/> |
| 281 | Version 1.0.1 |
| 282 | <span style="color: red; font-weight: bold;"></span> |
| 283 | <ul> |
| 284 | <li class="toctree-l1"><a class="reference internal" href="../../about.html">About this document</a></li> |
| 285 | </ul> |
| 286 | <ul class="current"> |
| 287 | <li class="toctree-l1"><a class="reference internal" href="../../overview/intro.html">1. Introduction</a></li> |
| 288 | <li class="toctree-l1"><a class="reference internal" href="../../overview/goals.html">2. Design goals</a></li> |
| 289 | <li class="toctree-l1"><a class="reference internal" href="../../overview/functionality.html">3. Functionality overview</a></li> |
| 290 | <li class="toctree-l1"><a class="reference internal" href="../../overview/sample-arch.html">4. Sample architectures</a></li> |
| 291 | <li class="toctree-l1"><a class="reference internal" href="../../overview/conventions.html">5. Library conventions</a></li> |
| 292 | <li class="toctree-l1"><a class="reference internal" href="../../overview/implementation.html">6. Implementation considerations</a></li> |
| 293 | <li class="toctree-l1"><a class="reference internal" href="../../overview/usage.html">7. Usage considerations</a></li> |
| 294 | <li class="toctree-l1"><a class="reference internal" href="../library/index.html">8. Library management reference</a></li> |
| 295 | <li class="toctree-l1"><a class="reference internal" href="../keys/index.html">9. Key management reference</a></li> |
| 296 | <li class="toctree-l1 current"><a class="reference internal" href="index.html">10. Cryptographic operation reference</a><ul class="current"> |
| 297 | <li class="toctree-l2 current"><a class="current reference internal" href="#">10.1. Algorithms</a><ul> |
| 298 | <li class="toctree-l3"><a class="reference internal" href="#algorithm-encoding">10.1.1. Algorithm encoding</a></li> |
| 299 | <li class="toctree-l3"><a class="reference internal" href="#algorithm-categories">10.1.2. Algorithm categories</a></li> |
| 300 | </ul> |
| 301 | </li> |
| 302 | <li class="toctree-l2"><a class="reference internal" href="hashes.html">10.2. Message digests</a></li> |
| 303 | <li class="toctree-l2"><a class="reference internal" href="macs.html">10.3. Message authentication codes (MAC)</a></li> |
| 304 | <li class="toctree-l2"><a class="reference internal" href="ciphers.html">10.4. Unauthenticated ciphers</a></li> |
| 305 | <li class="toctree-l2"><a class="reference internal" href="aead.html">10.5. Authenticated encryption with associated data (AEAD)</a></li> |
| 306 | <li class="toctree-l2"><a class="reference internal" href="kdf.html">10.6. Key derivation</a></li> |
| 307 | <li class="toctree-l2"><a class="reference internal" href="sign.html">10.7. Asymmetric signature</a></li> |
| 308 | <li class="toctree-l2"><a class="reference internal" href="pke.html">10.8. Asymmetric encryption</a></li> |
| 309 | <li class="toctree-l2"><a class="reference internal" href="ka.html">10.9. Key agreement</a></li> |
| 310 | <li class="toctree-l2"><a class="reference internal" href="rng.html">10.10. Other cryptographic services</a></li> |
| 311 | </ul> |
| 312 | </li> |
| 313 | </ul> |
| 314 | <ul> |
| 315 | <li class="toctree-l1"><a class="reference internal" href="../../appendix/example_header.html">Example header file</a></li> |
| 316 | <li class="toctree-l1"><a class="reference internal" href="../../appendix/specdef_values.html">Example macro implementations</a></li> |
| 317 | <li class="toctree-l1"><a class="reference internal" href="../../appendix/history.html">Changes to the API</a></li> |
| 318 | </ul> |
| 319 | <ul> |
| 320 | <li class="toctree-l1"><a class="reference internal" href="../../psa_c-identifiers.html">Index of API elements</a></li> |
| 321 | </ul> |
| 322 | <div id="searchbox" style="display: none" role="search"> |
| 323 | <h3>Quick search</h3> |
| 324 | <form class="search" action="../../search.html" method="get"> |
| 325 | <div><input type="text" name="q" /></div> |
| 326 | <div><input type="submit" value="Go" /></div> |
| 327 | <input type="hidden" name="check_keywords" value="yes" /> |
| 328 | <input type="hidden" name="area" value="default" /> |
| 329 | </form> |
| 330 | </div> |
| 331 | <script type="text/javascript">$('#searchbox').show(0);</script> |
| 332 | </div> |
| 333 | </div> |
| 334 | <div class="clearer"></div> |
| 335 | </div> |
| 336 | <div class="footer"> |
| 337 | © 2018-2020, Arm Limited or its affiliates. All rights reserved. |
| 338 | |
| 339 | | |
| 340 | Powered by <a href="http://sphinx-doc.org/">Sphinx 1.6.7</a> |
| 341 | & <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.8</a> |
| 342 | |
| 343 | </div> |
| 344 | |
| 345 | |
| 346 | |
| 347 | |
| 348 | </body> |
| 349 | </html> |