blob: 1cd612f41546a4563a0e3064bfe1f4494a741ae9 [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>10.10. Other cryptographic services &#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" />
18 <link rel="next" title="Example header file" href="../../appendix/example_header.html" />
Gilles Peskinec2db5f02021-01-18 20:36:53 +010019 <link rel="prev" title="10.9. Key agreement" href="ka.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="other-cryptographic-services">
Gilles Peskinec2db5f02021-01-18 20:36:53 +010037<h1>10.10. Other cryptographic services</h1>
Gilles Peskine6c723a22020-04-17 16:57:52 +020038<div class="section" id="random-number-generation">
Gilles Peskinec2db5f02021-01-18 20:36:53 +010039<span id="rng"></span><h2>10.10.1. Random number generation</h2>
Gilles Peskine6c723a22020-04-17 16:57:52 +020040<div class="section" id="psa_generate_random">
Bence Szépkútie26ccad2021-02-01 14:26:11 +010041<span id="c.psa_generate_random"></span><h3><code class="docutils literal notranslate"><span class="pre">psa_generate_random</span></code> (function)</h3>
Gilles Peskine6c723a22020-04-17 16:57:52 +020042<p>Generate random bytes.</p>
Bence Szépkútie26ccad2021-02-01 14:26:11 +010043<pre class="literal-block"><a class="reference internal" href="../library/status.html#c.psa_status_t" title="psa_status_t">psa_status_t</a> <a class="reference internal" href="#c.psa_generate_random" title="psa_generate_random">psa_generate_random</a>(uint8_t * output,
44 size_t output_size);</pre>
Gilles Peskine6c723a22020-04-17 16:57:52 +020045<p class="rubric">Parameters</p>
Bence Szépkútie26ccad2021-02-01 14:26:11 +010046<dl class="simple">
47<dt> <code class="docutils literal notranslate"><span class="pre">output</span></code></dt><dd><p>Output buffer for the generated data.</p>
48</dd>
49<dt> <code class="docutils literal notranslate"><span class="pre">output_size</span></code></dt><dd><p>Number of bytes to generate and output.</p>
50</dd>
Gilles Peskine6c723a22020-04-17 16:57:52 +020051</dl>
Bence Szépkútie26ccad2021-02-01 14:26:11 +010052<p class="rubric">Returns: <a class="reference internal" href="../library/status.html#c.psa_status_t" title="psa_status_t"><code class="docutils literal notranslate"><span class="pre">psa_status_t</span></code></a></p>
53<dl class="simple">
54<dt> <a class="reference internal" href="../library/status.html#c.PSA_SUCCESS" title="PSA_SUCCESS"><code class="docutils literal notranslate"><span class="pre">PSA_SUCCESS</span></code></a></dt><dd></dd>
55<dt> <a class="reference internal" href="../library/status.html#c.PSA_ERROR_NOT_SUPPORTED" title="PSA_ERROR_NOT_SUPPORTED"><code class="docutils literal notranslate"><span class="pre">PSA_ERROR_NOT_SUPPORTED</span></code></a></dt><dd></dd>
56<dt> <a class="reference internal" href="../library/status.html#c.PSA_ERROR_INSUFFICIENT_ENTROPY" title="PSA_ERROR_INSUFFICIENT_ENTROPY"><code class="docutils literal notranslate"><span class="pre">PSA_ERROR_INSUFFICIENT_ENTROPY</span></code></a></dt><dd></dd>
57<dt> <a class="reference internal" href="../library/status.html#c.PSA_ERROR_INSUFFICIENT_MEMORY" title="PSA_ERROR_INSUFFICIENT_MEMORY"><code class="docutils literal notranslate"><span class="pre">PSA_ERROR_INSUFFICIENT_MEMORY</span></code></a></dt><dd></dd>
58<dt> <a class="reference internal" href="../library/status.html#c.PSA_ERROR_COMMUNICATION_FAILURE" title="PSA_ERROR_COMMUNICATION_FAILURE"><code class="docutils literal notranslate"><span class="pre">PSA_ERROR_COMMUNICATION_FAILURE</span></code></a></dt><dd></dd>
59<dt> <a class="reference internal" href="../library/status.html#c.PSA_ERROR_HARDWARE_FAILURE" title="PSA_ERROR_HARDWARE_FAILURE"><code class="docutils literal notranslate"><span class="pre">PSA_ERROR_HARDWARE_FAILURE</span></code></a></dt><dd></dd>
60<dt> <a class="reference internal" href="../library/status.html#c.PSA_ERROR_CORRUPTION_DETECTED" title="PSA_ERROR_CORRUPTION_DETECTED"><code class="docutils literal notranslate"><span class="pre">PSA_ERROR_CORRUPTION_DETECTED</span></code></a></dt><dd></dd>
61<dt> <a class="reference internal" href="../library/status.html#c.PSA_ERROR_BAD_STATE" title="PSA_ERROR_BAD_STATE"><code class="docutils literal notranslate"><span class="pre">PSA_ERROR_BAD_STATE</span></code></a></dt><dd><p>The library has not been previously initialized by <a class="reference internal" href="../library/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>. It is implementation-dependent whether a failure to initialize results in this error code.</p>
62</dd>
Gilles Peskine6c723a22020-04-17 16:57:52 +020063</dl>
64<p class="rubric">Description</p>
65<div class="admonition warning">
Bence Szépkútie26ccad2021-02-01 14:26:11 +010066<p class="admonition-title">Warning</p>
67<p>This function <strong>can</strong> fail! Callers MUST check the return status and MUST NOT use the content of the output buffer if the return status is not <a class="reference internal" href="../library/status.html#c.PSA_SUCCESS" title="PSA_SUCCESS"><code class="xref any c c-macro docutils literal notranslate"><span class="pre">PSA_SUCCESS</span></code></a>.</p>
Gilles Peskine6c723a22020-04-17 16:57:52 +020068</div>
69<div class="admonition note">
Bence Szépkútie26ccad2021-02-01 14:26:11 +010070<p class="admonition-title">Note</p>
71<p>To generate a key, use <a class="reference internal" href="../keys/management.html#c.psa_generate_key" title="psa_generate_key"><code class="xref any c c-func docutils literal notranslate"><span class="pre">psa_generate_key()</span></code></a> instead.</p>
Gilles Peskine6c723a22020-04-17 16:57:52 +020072</div>
73</div>
74</div>
75</div>
76
77
78 </div>
Bence Szépkútie26ccad2021-02-01 14:26:11 +010079
Gilles Peskine6c723a22020-04-17 16:57:52 +020080 </div>
81 </div>
82 <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
Gilles Peskinec2db5f02021-01-18 20:36:53 +010083 <div class="sphinxsidebarwrapper"><h3><a href="../../index.html"><b>PSA Crypto API</b></a></h3>
84IHI 0086<br/>
85Non-confidential<br/>
86Version 1.0.1
87<span style="color: red; font-weight: bold;"></span>
Gilles Peskine6c723a22020-04-17 16:57:52 +020088<ul>
Gilles Peskinec2db5f02021-01-18 20:36:53 +010089<li class="toctree-l1"><a class="reference internal" href="../../about.html">About this document</a></li>
Gilles Peskine6c723a22020-04-17 16:57:52 +020090</ul>
Gilles Peskinec2db5f02021-01-18 20:36:53 +010091<ul class="current">
92<li class="toctree-l1"><a class="reference internal" href="../../overview/intro.html">1. Introduction</a></li>
93<li class="toctree-l1"><a class="reference internal" href="../../overview/goals.html">2. Design goals</a></li>
94<li class="toctree-l1"><a class="reference internal" href="../../overview/functionality.html">3. Functionality overview</a></li>
95<li class="toctree-l1"><a class="reference internal" href="../../overview/sample-arch.html">4. Sample architectures</a></li>
96<li class="toctree-l1"><a class="reference internal" href="../../overview/conventions.html">5. Library conventions</a></li>
97<li class="toctree-l1"><a class="reference internal" href="../../overview/implementation.html">6. Implementation considerations</a></li>
98<li class="toctree-l1"><a class="reference internal" href="../../overview/usage.html">7. Usage considerations</a></li>
99<li class="toctree-l1"><a class="reference internal" href="../library/index.html">8. Library management reference</a></li>
100<li class="toctree-l1"><a class="reference internal" href="../keys/index.html">9. Key management reference</a></li>
101<li class="toctree-l1 current"><a class="reference internal" href="index.html">10. Cryptographic operation reference</a><ul class="current">
102<li class="toctree-l2"><a class="reference internal" href="algorithms.html">10.1. Algorithms</a></li>
103<li class="toctree-l2"><a class="reference internal" href="hashes.html">10.2. Message digests</a></li>
104<li class="toctree-l2"><a class="reference internal" href="macs.html">10.3. Message authentication codes (MAC)</a></li>
105<li class="toctree-l2"><a class="reference internal" href="ciphers.html">10.4. Unauthenticated ciphers</a></li>
106<li class="toctree-l2"><a class="reference internal" href="aead.html">10.5. Authenticated encryption with associated data (AEAD)</a></li>
107<li class="toctree-l2"><a class="reference internal" href="kdf.html">10.6. Key derivation</a></li>
108<li class="toctree-l2"><a class="reference internal" href="sign.html">10.7. Asymmetric signature</a></li>
109<li class="toctree-l2"><a class="reference internal" href="pke.html">10.8. Asymmetric encryption</a></li>
110<li class="toctree-l2"><a class="reference internal" href="ka.html">10.9. Key agreement</a></li>
111<li class="toctree-l2 current"><a class="current reference internal" href="#">10.10. Other cryptographic services</a><ul>
112<li class="toctree-l3"><a class="reference internal" href="#random-number-generation">10.10.1. Random number generation</a></li>
113</ul>
114</li>
115</ul>
116</li>
117</ul>
118<ul>
119<li class="toctree-l1"><a class="reference internal" href="../../appendix/example_header.html">Example header file</a></li>
120<li class="toctree-l1"><a class="reference internal" href="../../appendix/specdef_values.html">Example macro implementations</a></li>
121<li class="toctree-l1"><a class="reference internal" href="../../appendix/history.html">Changes to the API</a></li>
122</ul>
123<ul>
124<li class="toctree-l1"><a class="reference internal" href="../../psa_c-identifiers.html">Index of API elements</a></li>
125</ul>
Gilles Peskine6c723a22020-04-17 16:57:52 +0200126<div id="searchbox" style="display: none" role="search">
Bence Szépkútie26ccad2021-02-01 14:26:11 +0100127 <h3 id="searchlabel">Quick search</h3>
128 <div class="searchformwrapper">
Gilles Peskine6c723a22020-04-17 16:57:52 +0200129 <form class="search" action="../../search.html" method="get">
Bence Szépkútie26ccad2021-02-01 14:26:11 +0100130 <input type="text" name="q" aria-labelledby="searchlabel" />
131 <input type="submit" value="Go" />
Gilles Peskine6c723a22020-04-17 16:57:52 +0200132 </form>
Bence Szépkútie26ccad2021-02-01 14:26:11 +0100133 </div>
Gilles Peskine6c723a22020-04-17 16:57:52 +0200134</div>
135<script type="text/javascript">$('#searchbox').show(0);</script>
136 </div>
137 </div>
138 <div class="clearer"></div>
139 </div>
140 <div class="footer">
Gilles Peskinec2db5f02021-01-18 20:36:53 +0100141 &copy; 2018-2020, Arm Limited or its affiliates. All rights reserved.
Gilles Peskine6c723a22020-04-17 16:57:52 +0200142
143 |
Bence Szépkútie26ccad2021-02-01 14:26:11 +0100144 Powered by <a href="http://sphinx-doc.org/">Sphinx 2.1.2</a>
145 &amp; <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.12</a>
Gilles Peskine6c723a22020-04-17 16:57:52 +0200146
Gilles Peskine6c723a22020-04-17 16:57:52 +0200147 </div>
148
149
150
151
152 </body>
153</html>