blob: 0d25663100a1d359ed74073f8106214b9e996dfe [file] [log] [blame]
Gilles Peskine6c723a22020-04-17 16:57:52 +02001
Bence Szépkútie26ccad2021-02-01 14:26:11 +01002<!DOCTYPE html>
Gilles Peskine6c723a22020-04-17 16:57:52 +02003
4<html xmlns="http://www.w3.org/1999/xhtml">
5 <head>
Bence Szépkútie26ccad2021-02-01 14:26:11 +01006 <meta charset="utf-8" />
Gilles Peskinec2db5f02021-01-18 20:36:53 +01007 <title>8.1. PSA status codes &#8212; PSA Crypto API 1.0.1 documentation</title>
Gilles Peskine6c723a22020-04-17 16:57:52 +02008 <link rel="stylesheet" href="../../_static/alabaster.css" type="text/css" />
9 <link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />
Bence Szépkútie26ccad2021-02-01 14:26:11 +010010 <script type="text/javascript" id="documentation_options" data-url_root="../../" src="../../_static/documentation_options.js"></script>
Gilles Peskine6c723a22020-04-17 16:57:52 +020011 <script type="text/javascript" src="../../_static/jquery.js"></script>
12 <script type="text/javascript" src="../../_static/underscore.js"></script>
13 <script type="text/javascript" src="../../_static/doctools.js"></script>
Bence Szépkútie26ccad2021-02-01 14:26:11 +010014 <script type="text/javascript" src="../../_static/language_data.js"></script>
Gilles Peskinec2db5f02021-01-18 20:36:53 +010015 <link rel="author" title="About these documents" href="../../about.html" />
Gilles Peskine6c723a22020-04-17 16:57:52 +020016 <link rel="index" title="Index" href="../../genindex.html" />
17 <link rel="search" title="Search" href="../../search.html" />
Gilles Peskinec2db5f02021-01-18 20:36:53 +010018 <link rel="next" title="8.2. PSA Crypto library" href="library.html" />
19 <link rel="prev" title="8. Library management reference" href="index.html" />
Gilles Peskine6c723a22020-04-17 16:57:52 +020020
21 <link rel="stylesheet" href="../../_static/custom.css" type="text/css" />
22
Bence Szépkútie26ccad2021-02-01 14:26:11 +010023
Gilles Peskine6c723a22020-04-17 16:57:52 +020024 <meta name="viewport" content="width=device-width, initial-scale=0.9, maximum-scale=0.9" />
25
Bence Szépkútie26ccad2021-02-01 14:26:11 +010026 </head><body>
Gilles Peskine6c723a22020-04-17 16:57:52 +020027
28
29 <div class="document">
30 <div class="documentwrapper">
31 <div class="bodywrapper">
Bence Szépkútie26ccad2021-02-01 14:26:11 +010032
33
Gilles Peskine6c723a22020-04-17 16:57:52 +020034 <div class="body" role="main">
35
36 <div class="section" id="psa-status-codes">
Gilles Peskinec2db5f02021-01-18 20:36:53 +010037<span id="status-codes"></span><h1>8.1. PSA status codes</h1>
Gilles Peskine6c723a22020-04-17 16:57:52 +020038<div class="section" id="status-type">
Gilles Peskinec2db5f02021-01-18 20:36:53 +010039<h2>8.1.1. Status type</h2>
Gilles Peskine6c723a22020-04-17 16:57:52 +020040<div class="section" id="psa_status_t">
Bence Szépkútie26ccad2021-02-01 14:26:11 +010041<span id="c.psa_status_t"></span><h3><code class="docutils literal notranslate"><span class="pre">psa_status_t</span></code> (type)</h3>
Gilles Peskine6c723a22020-04-17 16:57:52 +020042<p>Function return status.</p>
Bence Szépkútie26ccad2021-02-01 14:26:11 +010043<pre class="literal-block">typedef int32_t <a class="reference internal" href="#c.psa_status_t" title="psa_status_t">psa_status_t</a>;</pre>
44<p>This is either <a class="reference internal" href="#c.PSA_SUCCESS" title="PSA_SUCCESS"><code class="xref any c c-macro docutils literal notranslate"><span class="pre">PSA_SUCCESS</span></code></a>, which is zero, indicating success; or a small negative value indicating that an error occurred. Errors are encoded as one of the <code class="docutils literal notranslate"><span class="pre">PSA_ERROR_xxx</span></code> values defined here.</p>
Gilles Peskine6c723a22020-04-17 16:57:52 +020045</div>
46</div>
47<div class="section" id="success-codes">
Gilles Peskinec2db5f02021-01-18 20:36:53 +010048<h2>8.1.2. Success codes</h2>
Gilles Peskine6c723a22020-04-17 16:57:52 +020049<div class="section" id="PSA_SUCCESS">
Bence Szépkútie26ccad2021-02-01 14:26:11 +010050<span id="c.PSA_SUCCESS"></span><h3><code class="docutils literal notranslate"><span class="pre">PSA_SUCCESS</span></code> (macro)</h3>
Gilles Peskine6c723a22020-04-17 16:57:52 +020051<p>The action was completed successfully.</p>
Bence Szépkútie26ccad2021-02-01 14:26:11 +010052<pre class="literal-block">#define <a class="reference internal" href="#c.PSA_SUCCESS" title="PSA_SUCCESS">PSA_SUCCESS</a> ((<a class="reference internal" href="#c.psa_status_t" title="psa_status_t">psa_status_t</a>)0)</pre>
Gilles Peskine6c723a22020-04-17 16:57:52 +020053</div>
54</div>
55<div class="section" id="error-codes">
Gilles Peskinec2db5f02021-01-18 20:36:53 +010056<h2>8.1.3. Error codes</h2>
Gilles Peskine6c723a22020-04-17 16:57:52 +020057<div class="section" id="PSA_ERROR_GENERIC_ERROR">
Bence Szépkútie26ccad2021-02-01 14:26:11 +010058<span id="c.PSA_ERROR_GENERIC_ERROR"></span><h3><code class="docutils literal notranslate"><span class="pre">PSA_ERROR_GENERIC_ERROR</span></code> (macro)</h3>
Gilles Peskine6c723a22020-04-17 16:57:52 +020059<p>An error occurred that does not correspond to any defined failure cause.</p>
Bence Szépkútie26ccad2021-02-01 14:26:11 +010060<pre class="literal-block">#define <a class="reference internal" href="#c.PSA_ERROR_GENERIC_ERROR" title="PSA_ERROR_GENERIC_ERROR">PSA_ERROR_GENERIC_ERROR</a> ((<a class="reference internal" href="#c.psa_status_t" title="psa_status_t">psa_status_t</a>)-132)</pre>
Gilles Peskine6c723a22020-04-17 16:57:52 +020061<p>Implementations can use this error code if none of the other standard error codes are applicable.</p>
62</div>
63<div class="section" id="PSA_ERROR_NOT_SUPPORTED">
Bence Szépkútie26ccad2021-02-01 14:26:11 +010064<span id="c.PSA_ERROR_NOT_SUPPORTED"></span><h3><code class="docutils literal notranslate"><span class="pre">PSA_ERROR_NOT_SUPPORTED</span></code> (macro)</h3>
Gilles Peskine6c723a22020-04-17 16:57:52 +020065<p>The requested operation or a parameter is not supported by this implementation.</p>
Bence Szépkútie26ccad2021-02-01 14:26:11 +010066<pre class="literal-block">#define <a class="reference internal" href="#c.PSA_ERROR_NOT_SUPPORTED" title="PSA_ERROR_NOT_SUPPORTED">PSA_ERROR_NOT_SUPPORTED</a> ((<a class="reference internal" href="#c.psa_status_t" title="psa_status_t">psa_status_t</a>)-134)</pre>
67<p>It is recommended that implementations return this error code when an enumeration parameter such as a key type, algorithm, etc. is not recognized. If a combination of parameters is recognized and identified as not valid, return <a class="reference internal" href="#c.PSA_ERROR_INVALID_ARGUMENT" title="PSA_ERROR_INVALID_ARGUMENT"><code class="xref any c c-macro docutils literal notranslate"><span class="pre">PSA_ERROR_INVALID_ARGUMENT</span></code></a> instead.</p>
Gilles Peskine6c723a22020-04-17 16:57:52 +020068</div>
69<div class="section" id="PSA_ERROR_NOT_PERMITTED">
Bence Szépkútie26ccad2021-02-01 14:26:11 +010070<span id="c.PSA_ERROR_NOT_PERMITTED"></span><h3><code class="docutils literal notranslate"><span class="pre">PSA_ERROR_NOT_PERMITTED</span></code> (macro)</h3>
Gilles Peskine6c723a22020-04-17 16:57:52 +020071<p>The requested action is denied by a policy.</p>
Bence Szépkútie26ccad2021-02-01 14:26:11 +010072<pre class="literal-block">#define <a class="reference internal" href="#c.PSA_ERROR_NOT_PERMITTED" title="PSA_ERROR_NOT_PERMITTED">PSA_ERROR_NOT_PERMITTED</a> ((<a class="reference internal" href="#c.psa_status_t" title="psa_status_t">psa_status_t</a>)-133)</pre>
Gilles Peskine6c723a22020-04-17 16:57:52 +020073<p>It is recommended that implementations return this error code when the parameters are recognized as valid and supported, and a policy explicitly denies the requested operation.</p>
Bence Szépkútie26ccad2021-02-01 14:26:11 +010074<p>If a subset of the parameters of a function call identify a forbidden operation, and another subset of the parameters are not valid or not supported, it is unspecified whether the function returns <a class="reference internal" href="#c.PSA_ERROR_NOT_PERMITTED" title="PSA_ERROR_NOT_PERMITTED"><code class="xref any c c-macro docutils literal notranslate"><span class="pre">PSA_ERROR_NOT_PERMITTED</span></code></a>, <a class="reference internal" href="#c.PSA_ERROR_NOT_SUPPORTED" title="PSA_ERROR_NOT_SUPPORTED"><code class="xref any c c-macro docutils literal notranslate"><span class="pre">PSA_ERROR_NOT_SUPPORTED</span></code></a> or <a class="reference internal" href="#c.PSA_ERROR_INVALID_ARGUMENT" title="PSA_ERROR_INVALID_ARGUMENT"><code class="xref any c c-macro docutils literal notranslate"><span class="pre">PSA_ERROR_INVALID_ARGUMENT</span></code></a>.</p>
Gilles Peskine6c723a22020-04-17 16:57:52 +020075</div>
76<div class="section" id="PSA_ERROR_BUFFER_TOO_SMALL">
Bence Szépkútie26ccad2021-02-01 14:26:11 +010077<span id="c.PSA_ERROR_BUFFER_TOO_SMALL"></span><h3><code class="docutils literal notranslate"><span class="pre">PSA_ERROR_BUFFER_TOO_SMALL</span></code> (macro)</h3>
Gilles Peskine6c723a22020-04-17 16:57:52 +020078<p>An output buffer is too small.</p>
Bence Szépkútie26ccad2021-02-01 14:26:11 +010079<pre class="literal-block">#define <a class="reference internal" href="#c.PSA_ERROR_BUFFER_TOO_SMALL" title="PSA_ERROR_BUFFER_TOO_SMALL">PSA_ERROR_BUFFER_TOO_SMALL</a> ((<a class="reference internal" href="#c.psa_status_t" title="psa_status_t">psa_status_t</a>)-138)</pre>
80<p>Applications can call the <code class="docutils literal notranslate"><span class="pre">PSA_xxx_SIZE</span></code> macro listed in the function description to determine a sufficient buffer size.</p>
Gilles Peskine6c723a22020-04-17 16:57:52 +020081<p>It is recommended that implementations only return this error code in cases when performing the operation with a larger output buffer would succeed. However, implementations can also return this error if a function has invalid or unsupported parameters in addition to an insufficient output buffer size.</p>
82</div>
83<div class="section" id="PSA_ERROR_ALREADY_EXISTS">
Bence Szépkútie26ccad2021-02-01 14:26:11 +010084<span id="c.PSA_ERROR_ALREADY_EXISTS"></span><h3><code class="docutils literal notranslate"><span class="pre">PSA_ERROR_ALREADY_EXISTS</span></code> (macro)</h3>
Gilles Peskine6c723a22020-04-17 16:57:52 +020085<p>Asking for an item that already exists.</p>
Bence Szépkútie26ccad2021-02-01 14:26:11 +010086<pre class="literal-block">#define <a class="reference internal" href="#c.PSA_ERROR_ALREADY_EXISTS" title="PSA_ERROR_ALREADY_EXISTS">PSA_ERROR_ALREADY_EXISTS</a> ((<a class="reference internal" href="#c.psa_status_t" title="psa_status_t">psa_status_t</a>)-139)</pre>
Gilles Peskine6c723a22020-04-17 16:57:52 +020087<p>It is recommended that implementations return this error code when attempting to write to a location where a key is already present.</p>
88</div>
89<div class="section" id="PSA_ERROR_DOES_NOT_EXIST">
Bence Szépkútie26ccad2021-02-01 14:26:11 +010090<span id="c.PSA_ERROR_DOES_NOT_EXIST"></span><h3><code class="docutils literal notranslate"><span class="pre">PSA_ERROR_DOES_NOT_EXIST</span></code> (macro)</h3>
Gilles Peskine6c723a22020-04-17 16:57:52 +020091<p>Asking for an item that doesn’t exist.</p>
Bence Szépkútie26ccad2021-02-01 14:26:11 +010092<pre class="literal-block">#define <a class="reference internal" href="#c.PSA_ERROR_DOES_NOT_EXIST" title="PSA_ERROR_DOES_NOT_EXIST">PSA_ERROR_DOES_NOT_EXIST</a> ((<a class="reference internal" href="#c.psa_status_t" title="psa_status_t">psa_status_t</a>)-140)</pre>
93<p>Implementations must not return this error code to indicate that a key identifier is invalid, but must return <a class="reference internal" href="#c.PSA_ERROR_INVALID_HANDLE" title="PSA_ERROR_INVALID_HANDLE"><code class="xref any c c-macro docutils literal notranslate"><span class="pre">PSA_ERROR_INVALID_HANDLE</span></code></a> instead.</p>
Gilles Peskine6c723a22020-04-17 16:57:52 +020094</div>
95<div class="section" id="PSA_ERROR_BAD_STATE">
Bence Szépkútie26ccad2021-02-01 14:26:11 +010096<span id="c.PSA_ERROR_BAD_STATE"></span><h3><code class="docutils literal notranslate"><span class="pre">PSA_ERROR_BAD_STATE</span></code> (macro)</h3>
Gilles Peskine6c723a22020-04-17 16:57:52 +020097<p>The requested action cannot be performed in the current state.</p>
Bence Szépkútie26ccad2021-02-01 14:26:11 +010098<pre class="literal-block">#define <a class="reference internal" href="#c.PSA_ERROR_BAD_STATE" title="PSA_ERROR_BAD_STATE">PSA_ERROR_BAD_STATE</a> ((<a class="reference internal" href="#c.psa_status_t" title="psa_status_t">psa_status_t</a>)-137)</pre>
Gilles Peskine6c723a22020-04-17 16:57:52 +020099<p>Multi-part operations return this error when one of the functions is called out of sequence. Refer to the function descriptions for permitted sequencing of functions.</p>
Bence Szépkútie26ccad2021-02-01 14:26:11 +0100100<p>Implementations must not return this error code to indicate that a key identifier is invalid, but must return <a class="reference internal" href="#c.PSA_ERROR_INVALID_HANDLE" title="PSA_ERROR_INVALID_HANDLE"><code class="xref any c c-macro docutils literal notranslate"><span class="pre">PSA_ERROR_INVALID_HANDLE</span></code></a> instead.</p>
Gilles Peskine6c723a22020-04-17 16:57:52 +0200101</div>
102<div class="section" id="PSA_ERROR_INVALID_ARGUMENT">
Bence Szépkútie26ccad2021-02-01 14:26:11 +0100103<span id="c.PSA_ERROR_INVALID_ARGUMENT"></span><h3><code class="docutils literal notranslate"><span class="pre">PSA_ERROR_INVALID_ARGUMENT</span></code> (macro)</h3>
Gilles Peskine6c723a22020-04-17 16:57:52 +0200104<p>The parameters passed to the function are invalid.</p>
Bence Szépkútie26ccad2021-02-01 14:26:11 +0100105<pre class="literal-block">#define <a class="reference internal" href="#c.PSA_ERROR_INVALID_ARGUMENT" title="PSA_ERROR_INVALID_ARGUMENT">PSA_ERROR_INVALID_ARGUMENT</a> ((<a class="reference internal" href="#c.psa_status_t" title="psa_status_t">psa_status_t</a>)-135)</pre>
Gilles Peskine6c723a22020-04-17 16:57:52 +0200106<p>Implementations can return this error any time a parameter or combination of parameters are recognized as invalid.</p>
Bence Szépkútie26ccad2021-02-01 14:26:11 +0100107<p>Implementations must not return this error code to indicate that a key identifier is invalid, but must return <a class="reference internal" href="#c.PSA_ERROR_INVALID_HANDLE" title="PSA_ERROR_INVALID_HANDLE"><code class="xref any c c-macro docutils literal notranslate"><span class="pre">PSA_ERROR_INVALID_HANDLE</span></code></a> instead.</p>
Gilles Peskine6c723a22020-04-17 16:57:52 +0200108</div>
109<div class="section" id="PSA_ERROR_INSUFFICIENT_MEMORY">
Bence Szépkútie26ccad2021-02-01 14:26:11 +0100110<span id="c.PSA_ERROR_INSUFFICIENT_MEMORY"></span><h3><code class="docutils literal notranslate"><span class="pre">PSA_ERROR_INSUFFICIENT_MEMORY</span></code> (macro)</h3>
Gilles Peskine6c723a22020-04-17 16:57:52 +0200111<p>There is not enough runtime memory.</p>
Bence Szépkútie26ccad2021-02-01 14:26:11 +0100112<pre class="literal-block">#define <a class="reference internal" href="#c.PSA_ERROR_INSUFFICIENT_MEMORY" title="PSA_ERROR_INSUFFICIENT_MEMORY">PSA_ERROR_INSUFFICIENT_MEMORY</a> ((<a class="reference internal" href="#c.psa_status_t" title="psa_status_t">psa_status_t</a>)-141)</pre>
Gilles Peskine6c723a22020-04-17 16:57:52 +0200113<p>If the action is carried out across multiple security realms, this error can refer to available memory in any of the security realms.</p>
114</div>
115<div class="section" id="PSA_ERROR_INSUFFICIENT_STORAGE">
Bence Szépkútie26ccad2021-02-01 14:26:11 +0100116<span id="c.PSA_ERROR_INSUFFICIENT_STORAGE"></span><h3><code class="docutils literal notranslate"><span class="pre">PSA_ERROR_INSUFFICIENT_STORAGE</span></code> (macro)</h3>
Gilles Peskine6c723a22020-04-17 16:57:52 +0200117<p>There is not enough persistent storage.</p>
Bence Szépkútie26ccad2021-02-01 14:26:11 +0100118<pre class="literal-block">#define <a class="reference internal" href="#c.PSA_ERROR_INSUFFICIENT_STORAGE" title="PSA_ERROR_INSUFFICIENT_STORAGE">PSA_ERROR_INSUFFICIENT_STORAGE</a> ((<a class="reference internal" href="#c.psa_status_t" title="psa_status_t">psa_status_t</a>)-142)</pre>
Gilles Peskine6c723a22020-04-17 16:57:52 +0200119<p>Functions that modify the key storage return this error code if there is insufficient storage space on the host media. In addition, many functions that do not otherwise access storage might return this error code if the implementation requires a mandatory log entry for the requested action and the log storage space is full.</p>
120</div>
121<div class="section" id="PSA_ERROR_COMMUNICATION_FAILURE">
Bence Szépkútie26ccad2021-02-01 14:26:11 +0100122<span id="c.PSA_ERROR_COMMUNICATION_FAILURE"></span><h3><code class="docutils literal notranslate"><span class="pre">PSA_ERROR_COMMUNICATION_FAILURE</span></code> (macro)</h3>
Gilles Peskine6c723a22020-04-17 16:57:52 +0200123<p>There was a communication failure inside the implementation.</p>
Bence Szépkútie26ccad2021-02-01 14:26:11 +0100124<pre class="literal-block">#define <a class="reference internal" href="#c.PSA_ERROR_COMMUNICATION_FAILURE" title="PSA_ERROR_COMMUNICATION_FAILURE">PSA_ERROR_COMMUNICATION_FAILURE</a> ((<a class="reference internal" href="#c.psa_status_t" title="psa_status_t">psa_status_t</a>)-145)</pre>
Gilles Peskine6c723a22020-04-17 16:57:52 +0200125<p>This can indicate a communication failure between the application and an external cryptoprocessor or between the cryptoprocessor and an external volatile or persistent memory. A communication failure can be transient or permanent depending on the cause.</p>
126<div class="admonition warning">
Bence Szépkútie26ccad2021-02-01 14:26:11 +0100127<p class="admonition-title">Warning</p>
128<p>If a function returns this error, it is undetermined whether the requested action has completed. Returning <a class="reference internal" href="#c.PSA_SUCCESS" title="PSA_SUCCESS"><code class="xref any c c-macro docutils literal notranslate"><span class="pre">PSA_SUCCESS</span></code></a> is recommended on successful completion whenever possible, however functions can return <a class="reference internal" href="#c.PSA_ERROR_COMMUNICATION_FAILURE" title="PSA_ERROR_COMMUNICATION_FAILURE"><code class="xref any c c-macro docutils literal notranslate"><span class="pre">PSA_ERROR_COMMUNICATION_FAILURE</span></code></a> if the requested action was completed successfully in an external cryptoprocessor but there was a breakdown of communication before the cryptoprocessor could report the status to the application.</p>
Gilles Peskine6c723a22020-04-17 16:57:52 +0200129</div>
130</div>
131<div class="section" id="PSA_ERROR_STORAGE_FAILURE">
Bence Szépkútie26ccad2021-02-01 14:26:11 +0100132<span id="c.PSA_ERROR_STORAGE_FAILURE"></span><h3><code class="docutils literal notranslate"><span class="pre">PSA_ERROR_STORAGE_FAILURE</span></code> (macro)</h3>
Gilles Peskine6c723a22020-04-17 16:57:52 +0200133<p>There was a storage failure that might have led to data loss.</p>
Bence Szépkútie26ccad2021-02-01 14:26:11 +0100134<pre class="literal-block">#define <a class="reference internal" href="#c.PSA_ERROR_STORAGE_FAILURE" title="PSA_ERROR_STORAGE_FAILURE">PSA_ERROR_STORAGE_FAILURE</a> ((<a class="reference internal" href="#c.psa_status_t" title="psa_status_t">psa_status_t</a>)-146)</pre>
Gilles Peskine6c723a22020-04-17 16:57:52 +0200135<p>This error indicates that some persistent storage could not be read or written by the implementation. It does not indicate the following situations, which have specific error codes:</p>
136<ul class="simple">
Bence Szépkútie26ccad2021-02-01 14:26:11 +0100137<li><p>A corruption of volatile memory - use <a class="reference internal" href="#c.PSA_ERROR_CORRUPTION_DETECTED" title="PSA_ERROR_CORRUPTION_DETECTED"><code class="xref any c c-macro docutils literal notranslate"><span class="pre">PSA_ERROR_CORRUPTION_DETECTED</span></code></a>.</p></li>
138<li><p>A communication error between the cryptoprocessor and its external storage - use <a class="reference internal" href="#c.PSA_ERROR_COMMUNICATION_FAILURE" title="PSA_ERROR_COMMUNICATION_FAILURE"><code class="xref any c c-macro docutils literal notranslate"><span class="pre">PSA_ERROR_COMMUNICATION_FAILURE</span></code></a>.</p></li>
139<li><p>When the storage is in a valid state but is full - use <a class="reference internal" href="#c.PSA_ERROR_INSUFFICIENT_STORAGE" title="PSA_ERROR_INSUFFICIENT_STORAGE"><code class="xref any c c-macro docutils literal notranslate"><span class="pre">PSA_ERROR_INSUFFICIENT_STORAGE</span></code></a>.</p></li>
140<li><p>When the storage or stored data is corrupted - use <a class="reference internal" href="#c.PSA_ERROR_DATA_CORRUPT" title="PSA_ERROR_DATA_CORRUPT"><code class="xref any c c-macro docutils literal notranslate"><span class="pre">PSA_ERROR_DATA_CORRUPT</span></code></a>.</p></li>
141<li><p>When the stored data is not valid - use <a class="reference internal" href="#c.PSA_ERROR_DATA_INVALID" title="PSA_ERROR_DATA_INVALID"><code class="xref any c c-macro docutils literal notranslate"><span class="pre">PSA_ERROR_DATA_INVALID</span></code></a>.</p></li>
Gilles Peskine6c723a22020-04-17 16:57:52 +0200142</ul>
143<p>A storage failure does not indicate that any data that was previously read is invalid. However this previously read data might no longer be readable from storage.</p>
144<p>When a storage failure occurs, it is no longer possible to ensure the global integrity of the keystore. Depending on the global integrity guarantees offered by the implementation, access to other data might fail even if the data is still readable but its integrity cannot be guaranteed.</p>
145<p>It is recommended to only use this error code to report a permanent storage corruption. However application writers must keep in mind that transient errors while reading the storage might be reported using this error code.</p>
146</div>
147<div class="section" id="PSA_ERROR_DATA_CORRUPT">
Bence Szépkútie26ccad2021-02-01 14:26:11 +0100148<span id="c.PSA_ERROR_DATA_CORRUPT"></span><h3><code class="docutils literal notranslate"><span class="pre">PSA_ERROR_DATA_CORRUPT</span></code> (macro)</h3>
Gilles Peskine6c723a22020-04-17 16:57:52 +0200149<p>Stored data has been corrupted.</p>
Bence Szépkútie26ccad2021-02-01 14:26:11 +0100150<pre class="literal-block">#define <a class="reference internal" href="#c.PSA_ERROR_DATA_CORRUPT" title="PSA_ERROR_DATA_CORRUPT">PSA_ERROR_DATA_CORRUPT</a> ((<a class="reference internal" href="#c.psa_status_t" title="psa_status_t">psa_status_t</a>)-152)</pre>
Gilles Peskine6c723a22020-04-17 16:57:52 +0200151<p>This error indicates that some persistent storage has suffered corruption. It does not indicate the following situations, which have specific error codes:</p>
152<ul class="simple">
Bence Szépkútie26ccad2021-02-01 14:26:11 +0100153<li><p>A corruption of volatile memory - use <a class="reference internal" href="#c.PSA_ERROR_CORRUPTION_DETECTED" title="PSA_ERROR_CORRUPTION_DETECTED"><code class="xref any c c-macro docutils literal notranslate"><span class="pre">PSA_ERROR_CORRUPTION_DETECTED</span></code></a>.</p></li>
154<li><p>A communication error between the cryptoprocessor and its external storage - use <a class="reference internal" href="#c.PSA_ERROR_COMMUNICATION_FAILURE" title="PSA_ERROR_COMMUNICATION_FAILURE"><code class="xref any c c-macro docutils literal notranslate"><span class="pre">PSA_ERROR_COMMUNICATION_FAILURE</span></code></a>.</p></li>
155<li><p>When the storage is in a valid state but is full - use <a class="reference internal" href="#c.PSA_ERROR_INSUFFICIENT_STORAGE" title="PSA_ERROR_INSUFFICIENT_STORAGE"><code class="xref any c c-macro docutils literal notranslate"><span class="pre">PSA_ERROR_INSUFFICIENT_STORAGE</span></code></a>.</p></li>
156<li><p>When the storage fails for other reasons - use <a class="reference internal" href="#c.PSA_ERROR_STORAGE_FAILURE" title="PSA_ERROR_STORAGE_FAILURE"><code class="xref any c c-macro docutils literal notranslate"><span class="pre">PSA_ERROR_STORAGE_FAILURE</span></code></a>.</p></li>
157<li><p>When the stored data is not valid - use <a class="reference internal" href="#c.PSA_ERROR_DATA_INVALID" title="PSA_ERROR_DATA_INVALID"><code class="xref any c c-macro docutils literal notranslate"><span class="pre">PSA_ERROR_DATA_INVALID</span></code></a>.</p></li>
Gilles Peskine6c723a22020-04-17 16:57:52 +0200158</ul>
159<p>Note that a storage corruption does not indicate that any data that was previously read is invalid. However this previously read data might no longer be readable from storage.</p>
160<p>When a storage failure occurs, it is no longer possible to ensure the global integrity of the keystore. Depending on the global integrity guarantees offered by the implementation, access to other data might fail even if the data is still readable but its integrity cannot be guaranteed.</p>
Bence Szépkútie26ccad2021-02-01 14:26:11 +0100161<p>It is recommended to only use this error code to report when a storage component indicates that the stored data is corrupt, or fails an integrity check. For example, in situations that the <span><em>PSA Storage API</em> <a class="reference internal" href="../../about.html#citation-psa-its"><span class="cite">[PSA-ITS]</span></a></span> reports <a class="reference internal" href="#c.PSA_ERROR_DATA_CORRUPT" title="PSA_ERROR_DATA_CORRUPT"><code class="xref any c c-macro docutils literal notranslate"><span class="pre">PSA_ERROR_DATA_CORRUPT</span></code></a> or <a class="reference internal" href="#c.PSA_ERROR_INVALID_SIGNATURE" title="PSA_ERROR_INVALID_SIGNATURE"><code class="xref any c c-macro docutils literal notranslate"><span class="pre">PSA_ERROR_INVALID_SIGNATURE</span></code></a>.</p>
Gilles Peskine6c723a22020-04-17 16:57:52 +0200162</div>
163<div class="section" id="PSA_ERROR_DATA_INVALID">
Bence Szépkútie26ccad2021-02-01 14:26:11 +0100164<span id="c.PSA_ERROR_DATA_INVALID"></span><h3><code class="docutils literal notranslate"><span class="pre">PSA_ERROR_DATA_INVALID</span></code> (macro)</h3>
Gilles Peskine6c723a22020-04-17 16:57:52 +0200165<p>Data read from storage is not valid for the implementation.</p>
Bence Szépkútie26ccad2021-02-01 14:26:11 +0100166<pre class="literal-block">#define <a class="reference internal" href="#c.PSA_ERROR_DATA_INVALID" title="PSA_ERROR_DATA_INVALID">PSA_ERROR_DATA_INVALID</a> ((<a class="reference internal" href="#c.psa_status_t" title="psa_status_t">psa_status_t</a>)-153)</pre>
Gilles Peskine6c723a22020-04-17 16:57:52 +0200167<p>This error indicates that some data read from storage does not have a valid format. It does not indicate the following situations, which have specific error codes:</p>
168<ul class="simple">
Bence Szépkútie26ccad2021-02-01 14:26:11 +0100169<li><p>When the storage or stored data is corrupted - use <a class="reference internal" href="#c.PSA_ERROR_DATA_CORRUPT" title="PSA_ERROR_DATA_CORRUPT"><code class="xref any c c-macro docutils literal notranslate"><span class="pre">PSA_ERROR_DATA_CORRUPT</span></code></a>.</p></li>
170<li><p>When the storage fails for other reasons - use <a class="reference internal" href="#c.PSA_ERROR_STORAGE_FAILURE" title="PSA_ERROR_STORAGE_FAILURE"><code class="xref any c c-macro docutils literal notranslate"><span class="pre">PSA_ERROR_STORAGE_FAILURE</span></code></a>.</p></li>
171<li><p>An invalid argument to the API - use <a class="reference internal" href="#c.PSA_ERROR_INVALID_ARGUMENT" title="PSA_ERROR_INVALID_ARGUMENT"><code class="xref any c c-macro docutils literal notranslate"><span class="pre">PSA_ERROR_INVALID_ARGUMENT</span></code></a>.</p></li>
Gilles Peskine6c723a22020-04-17 16:57:52 +0200172</ul>
173<p>This error is typically a result of an integration failure, where the implementation reading the data is not compatible with the implementation that stored the data.</p>
174<p>It is recommended to only use this error code to report when data that is successfully read from storage is invalid.</p>
175</div>
176<div class="section" id="PSA_ERROR_HARDWARE_FAILURE">
Bence Szépkútie26ccad2021-02-01 14:26:11 +0100177<span id="c.PSA_ERROR_HARDWARE_FAILURE"></span><h3><code class="docutils literal notranslate"><span class="pre">PSA_ERROR_HARDWARE_FAILURE</span></code> (macro)</h3>
Gilles Peskine6c723a22020-04-17 16:57:52 +0200178<p>A hardware failure was detected.</p>
Bence Szépkútie26ccad2021-02-01 14:26:11 +0100179<pre class="literal-block">#define <a class="reference internal" href="#c.PSA_ERROR_HARDWARE_FAILURE" title="PSA_ERROR_HARDWARE_FAILURE">PSA_ERROR_HARDWARE_FAILURE</a> ((<a class="reference internal" href="#c.psa_status_t" title="psa_status_t">psa_status_t</a>)-147)</pre>
Gilles Peskine6c723a22020-04-17 16:57:52 +0200180<p>A hardware failure can be transient or permanent depending on the cause.</p>
181</div>
182<div class="section" id="PSA_ERROR_CORRUPTION_DETECTED">
Bence Szépkútie26ccad2021-02-01 14:26:11 +0100183<span id="c.PSA_ERROR_CORRUPTION_DETECTED"></span><h3><code class="docutils literal notranslate"><span class="pre">PSA_ERROR_CORRUPTION_DETECTED</span></code> (macro)</h3>
Gilles Peskine6c723a22020-04-17 16:57:52 +0200184<p>A tampering attempt was detected.</p>
Bence Szépkútie26ccad2021-02-01 14:26:11 +0100185<pre class="literal-block">#define <a class="reference internal" href="#c.PSA_ERROR_CORRUPTION_DETECTED" title="PSA_ERROR_CORRUPTION_DETECTED">PSA_ERROR_CORRUPTION_DETECTED</a> ((<a class="reference internal" href="#c.psa_status_t" title="psa_status_t">psa_status_t</a>)-151)</pre>
Gilles Peskine6c723a22020-04-17 16:57:52 +0200186<p>If an application receives this error code, there is no guarantee that previously accessed or computed data was correct and remains confidential. In this situation, it is recommended that applications perform no further security functions and enter a safe failure state.</p>
187<p>Implementations can return this error code if they detect an invalid state that cannot happen during normal operation and that indicates that the implementation’s security guarantees no longer hold. Depending on the implementation architecture and on its security and safety goals, the implementation might forcibly terminate the application.</p>
Bence Szépkútie26ccad2021-02-01 14:26:11 +0100188<p>This error code is intended as a last resort when a security breach is detected and it is unsure whether the keystore data is still protected. Implementations must only return this error code to report an alarm from a tampering detector, to indicate that the confidentiality of stored data can no longer be guaranteed, or to indicate that the integrity of previously returned data is now considered compromised. Implementations must not use this error code to indicate a hardware failure that merely makes it impossible to perform the requested operation, instead use <a class="reference internal" href="#c.PSA_ERROR_COMMUNICATION_FAILURE" title="PSA_ERROR_COMMUNICATION_FAILURE"><code class="xref any c c-macro docutils literal notranslate"><span class="pre">PSA_ERROR_COMMUNICATION_FAILURE</span></code></a>, <a class="reference internal" href="#c.PSA_ERROR_STORAGE_FAILURE" title="PSA_ERROR_STORAGE_FAILURE"><code class="xref any c c-macro docutils literal notranslate"><span class="pre">PSA_ERROR_STORAGE_FAILURE</span></code></a>, <a class="reference internal" href="#c.PSA_ERROR_HARDWARE_FAILURE" title="PSA_ERROR_HARDWARE_FAILURE"><code class="xref any c c-macro docutils literal notranslate"><span class="pre">PSA_ERROR_HARDWARE_FAILURE</span></code></a>, <a class="reference internal" href="#c.PSA_ERROR_INSUFFICIENT_ENTROPY" title="PSA_ERROR_INSUFFICIENT_ENTROPY"><code class="xref any c c-macro docutils literal notranslate"><span class="pre">PSA_ERROR_INSUFFICIENT_ENTROPY</span></code></a> or other applicable error code.</p>
Gilles Peskine6c723a22020-04-17 16:57:52 +0200189<p>This error indicates an attack against the application. Implementations must not return this error code as a consequence of the behavior of the application itself.</p>
190</div>
191<div class="section" id="PSA_ERROR_INSUFFICIENT_ENTROPY">
Bence Szépkútie26ccad2021-02-01 14:26:11 +0100192<span id="c.PSA_ERROR_INSUFFICIENT_ENTROPY"></span><h3><code class="docutils literal notranslate"><span class="pre">PSA_ERROR_INSUFFICIENT_ENTROPY</span></code> (macro)</h3>
Gilles Peskine6c723a22020-04-17 16:57:52 +0200193<p>There is not enough entropy to generate random data needed for the requested action.</p>
Bence Szépkútie26ccad2021-02-01 14:26:11 +0100194<pre class="literal-block">#define <a class="reference internal" href="#c.PSA_ERROR_INSUFFICIENT_ENTROPY" title="PSA_ERROR_INSUFFICIENT_ENTROPY">PSA_ERROR_INSUFFICIENT_ENTROPY</a> ((<a class="reference internal" href="#c.psa_status_t" title="psa_status_t">psa_status_t</a>)-148)</pre>
Gilles Peskine6c723a22020-04-17 16:57:52 +0200195<p>This error indicates a failure of a hardware random generator. Application writers must note that this error can be returned not only by functions whose purpose is to generate random data, such as key, IV or nonce generation, but also by functions that execute an algorithm with a randomized result, as well as functions that use randomization of intermediate computations as a countermeasure to certain attacks.</p>
Bence Szépkútie26ccad2021-02-01 14:26:11 +0100196<p>It is recommended that implementations do not return this error after <a class="reference internal" href="library.html#c.psa_crypto_init" title="psa_crypto_init"><code class="xref any c c-func docutils literal notranslate"><span class="pre">psa_crypto_init()</span></code></a> has succeeded. This can be achieved if the implementation generates sufficient entropy during initialization and subsequently a cryptographically secure pseudorandom generator (PRNG) is used. However, implementations might return this error at any time, for example, if a policy requires the PRNG to be reseeded during normal operation.</p>
Gilles Peskine6c723a22020-04-17 16:57:52 +0200197</div>
198<div class="section" id="PSA_ERROR_INVALID_SIGNATURE">
Bence Szépkútie26ccad2021-02-01 14:26:11 +0100199<span id="c.PSA_ERROR_INVALID_SIGNATURE"></span><h3><code class="docutils literal notranslate"><span class="pre">PSA_ERROR_INVALID_SIGNATURE</span></code> (macro)</h3>
Gilles Peskine6c723a22020-04-17 16:57:52 +0200200<p>The signature, MAC or hash is incorrect.</p>
Bence Szépkútie26ccad2021-02-01 14:26:11 +0100201<pre class="literal-block">#define <a class="reference internal" href="#c.PSA_ERROR_INVALID_SIGNATURE" title="PSA_ERROR_INVALID_SIGNATURE">PSA_ERROR_INVALID_SIGNATURE</a> ((<a class="reference internal" href="#c.psa_status_t" title="psa_status_t">psa_status_t</a>)-149)</pre>
Gilles Peskine6c723a22020-04-17 16:57:52 +0200202<p>Verification functions return this error if the verification calculations completed successfully, and the value to be verified was determined to be incorrect.</p>
Bence Szépkútie26ccad2021-02-01 14:26:11 +0100203<p>If the value to verify has an invalid size, implementations can return either <a class="reference internal" href="#c.PSA_ERROR_INVALID_ARGUMENT" title="PSA_ERROR_INVALID_ARGUMENT"><code class="xref any c c-macro docutils literal notranslate"><span class="pre">PSA_ERROR_INVALID_ARGUMENT</span></code></a> or <a class="reference internal" href="#c.PSA_ERROR_INVALID_SIGNATURE" title="PSA_ERROR_INVALID_SIGNATURE"><code class="xref any c c-macro docutils literal notranslate"><span class="pre">PSA_ERROR_INVALID_SIGNATURE</span></code></a>.</p>
Gilles Peskine6c723a22020-04-17 16:57:52 +0200204</div>
205<div class="section" id="PSA_ERROR_INVALID_PADDING">
Bence Szépkútie26ccad2021-02-01 14:26:11 +0100206<span id="c.PSA_ERROR_INVALID_PADDING"></span><h3><code class="docutils literal notranslate"><span class="pre">PSA_ERROR_INVALID_PADDING</span></code> (macro)</h3>
Gilles Peskine6c723a22020-04-17 16:57:52 +0200207<p>The decrypted padding is incorrect.</p>
Bence Szépkútie26ccad2021-02-01 14:26:11 +0100208<pre class="literal-block">#define <a class="reference internal" href="#c.PSA_ERROR_INVALID_PADDING" title="PSA_ERROR_INVALID_PADDING">PSA_ERROR_INVALID_PADDING</a> ((<a class="reference internal" href="#c.psa_status_t" title="psa_status_t">psa_status_t</a>)-150)</pre>
Gilles Peskine6c723a22020-04-17 16:57:52 +0200209<div class="admonition warning">
Bence Szépkútie26ccad2021-02-01 14:26:11 +0100210<p class="admonition-title">Warning</p>
211<p>In some protocols, when decrypting data, it is essential that the behavior of the application does not depend on whether the padding is correct, down to precise timing. Protocols that use authenticated encryption are recommended for use by applications, rather than plain encryption. If the application must perform a decryption of unauthenticated data, the application writer must take care not to reveal whether the padding is invalid.</p>
Gilles Peskine6c723a22020-04-17 16:57:52 +0200212</div>
213<p>Implementations must handle padding carefully, aiming to make it impossible for an external observer to distinguish between valid and invalid padding. In particular, it is recommended that the timing of a decryption operation does not depend on the validity of the padding.</p>
214</div>
215<div class="section" id="PSA_ERROR_INSUFFICIENT_DATA">
Bence Szépkútie26ccad2021-02-01 14:26:11 +0100216<span id="c.PSA_ERROR_INSUFFICIENT_DATA"></span><h3><code class="docutils literal notranslate"><span class="pre">PSA_ERROR_INSUFFICIENT_DATA</span></code> (macro)</h3>
Gilles Peskine6c723a22020-04-17 16:57:52 +0200217<p>Return this error when there’s insufficient data when attempting to read from a resource.</p>
Bence Szépkútie26ccad2021-02-01 14:26:11 +0100218<pre class="literal-block">#define <a class="reference internal" href="#c.PSA_ERROR_INSUFFICIENT_DATA" title="PSA_ERROR_INSUFFICIENT_DATA">PSA_ERROR_INSUFFICIENT_DATA</a> ((<a class="reference internal" href="#c.psa_status_t" title="psa_status_t">psa_status_t</a>)-143)</pre>
Gilles Peskine6c723a22020-04-17 16:57:52 +0200219</div>
220<div class="section" id="PSA_ERROR_INVALID_HANDLE">
Bence Szépkútie26ccad2021-02-01 14:26:11 +0100221<span id="c.PSA_ERROR_INVALID_HANDLE"></span><h3><code class="docutils literal notranslate"><span class="pre">PSA_ERROR_INVALID_HANDLE</span></code> (macro)</h3>
Gilles Peskine6c723a22020-04-17 16:57:52 +0200222<p>The key identifier is not valid.</p>
Bence Szépkútie26ccad2021-02-01 14:26:11 +0100223<pre class="literal-block">#define <a class="reference internal" href="#c.PSA_ERROR_INVALID_HANDLE" title="PSA_ERROR_INVALID_HANDLE">PSA_ERROR_INVALID_HANDLE</a> ((<a class="reference internal" href="#c.psa_status_t" title="psa_status_t">psa_status_t</a>)-136)</pre>
Gilles Peskinec2db5f02021-01-18 20:36:53 +0100224<p>See also <a class="reference internal" href="../../overview/functionality.html#key-ids"><span class="secref">Key identifiers</span></a>.</p>
Gilles Peskine6c723a22020-04-17 16:57:52 +0200225</div>
226</div>
227</div>
228
229
230 </div>
Bence Szépkútie26ccad2021-02-01 14:26:11 +0100231
Gilles Peskine6c723a22020-04-17 16:57:52 +0200232 </div>
233 </div>
234 <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
Gilles Peskinec2db5f02021-01-18 20:36:53 +0100235 <div class="sphinxsidebarwrapper"><h3><a href="../../index.html"><b>PSA Crypto API</b></a></h3>
236IHI 0086<br/>
237Non-confidential<br/>
238Version 1.0.1
239<span style="color: red; font-weight: bold;"></span>
Gilles Peskine6c723a22020-04-17 16:57:52 +0200240<ul>
Gilles Peskinec2db5f02021-01-18 20:36:53 +0100241<li class="toctree-l1"><a class="reference internal" href="../../about.html">About this document</a></li>
Gilles Peskine6c723a22020-04-17 16:57:52 +0200242</ul>
Gilles Peskinec2db5f02021-01-18 20:36:53 +0100243<ul class="current">
244<li class="toctree-l1"><a class="reference internal" href="../../overview/intro.html">1. Introduction</a></li>
245<li class="toctree-l1"><a class="reference internal" href="../../overview/goals.html">2. Design goals</a></li>
246<li class="toctree-l1"><a class="reference internal" href="../../overview/functionality.html">3. Functionality overview</a></li>
247<li class="toctree-l1"><a class="reference internal" href="../../overview/sample-arch.html">4. Sample architectures</a></li>
248<li class="toctree-l1"><a class="reference internal" href="../../overview/conventions.html">5. Library conventions</a></li>
249<li class="toctree-l1"><a class="reference internal" href="../../overview/implementation.html">6. Implementation considerations</a></li>
250<li class="toctree-l1"><a class="reference internal" href="../../overview/usage.html">7. Usage considerations</a></li>
251<li class="toctree-l1 current"><a class="reference internal" href="index.html">8. Library management reference</a><ul class="current">
252<li class="toctree-l2 current"><a class="current reference internal" href="#">8.1. PSA status codes</a><ul>
253<li class="toctree-l3"><a class="reference internal" href="#status-type">8.1.1. Status type</a></li>
254<li class="toctree-l3"><a class="reference internal" href="#success-codes">8.1.2. Success codes</a></li>
255<li class="toctree-l3"><a class="reference internal" href="#error-codes">8.1.3. Error codes</a></li>
256</ul>
257</li>
258<li class="toctree-l2"><a class="reference internal" href="library.html">8.2. PSA Crypto library</a></li>
259</ul>
260</li>
261<li class="toctree-l1"><a class="reference internal" href="../keys/index.html">9. Key management reference</a></li>
262<li class="toctree-l1"><a class="reference internal" href="../ops/index.html">10. Cryptographic operation reference</a></li>
263</ul>
264<ul>
265<li class="toctree-l1"><a class="reference internal" href="../../appendix/example_header.html">Example header file</a></li>
266<li class="toctree-l1"><a class="reference internal" href="../../appendix/specdef_values.html">Example macro implementations</a></li>
267<li class="toctree-l1"><a class="reference internal" href="../../appendix/history.html">Changes to the API</a></li>
268</ul>
269<ul>
270<li class="toctree-l1"><a class="reference internal" href="../../psa_c-identifiers.html">Index of API elements</a></li>
271</ul>
Gilles Peskine6c723a22020-04-17 16:57:52 +0200272<div id="searchbox" style="display: none" role="search">
Bence Szépkútie26ccad2021-02-01 14:26:11 +0100273 <h3 id="searchlabel">Quick search</h3>
274 <div class="searchformwrapper">
Gilles Peskine6c723a22020-04-17 16:57:52 +0200275 <form class="search" action="../../search.html" method="get">
Bence Szépkútie26ccad2021-02-01 14:26:11 +0100276 <input type="text" name="q" aria-labelledby="searchlabel" />
277 <input type="submit" value="Go" />
Gilles Peskine6c723a22020-04-17 16:57:52 +0200278 </form>
Bence Szépkútie26ccad2021-02-01 14:26:11 +0100279 </div>
Gilles Peskine6c723a22020-04-17 16:57:52 +0200280</div>
281<script type="text/javascript">$('#searchbox').show(0);</script>
282 </div>
283 </div>
284 <div class="clearer"></div>
285 </div>
286 <div class="footer">
Gilles Peskinec2db5f02021-01-18 20:36:53 +0100287 &copy; 2018-2020, Arm Limited or its affiliates. All rights reserved.
Gilles Peskine6c723a22020-04-17 16:57:52 +0200288
289 |
Bence Szépkútie26ccad2021-02-01 14:26:11 +0100290 Powered by <a href="http://sphinx-doc.org/">Sphinx 2.1.2</a>
291 &amp; <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.12</a>
Gilles Peskine6c723a22020-04-17 16:57:52 +0200292
Gilles Peskine6c723a22020-04-17 16:57:52 +0200293 </div>
294
295
296
297
298 </body>
299</html>