blob: 949fe20ec3f3111cced1a0efe6d6965bf18321af [file] [log] [blame]
Gilles Peskine6c723a22020-04-17 16:57:52 +02001
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" />
Gilles Peskinec2db5f02021-01-18 20:36:53 +01008 <title>10.10. Other cryptographic services &#8212; PSA Crypto API 1.0.1 documentation</title>
Gilles Peskine6c723a22020-04-17 16:57:52 +02009 <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: '../../',
Gilles Peskinec2db5f02021-01-18 20:36:53 +010014 VERSION: '1.0.1',
Gilles Peskine6c723a22020-04-17 16:57:52 +020015 COLLAPSE_INDEX: false,
16 FILE_SUFFIX: '.html',
Gilles Peskinec2db5f02021-01-18 20:36:53 +010017 HAS_SOURCE: false,
Gilles Peskine6c723a22020-04-17 16:57:52 +020018 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>
Gilles Peskinec2db5f02021-01-18 20:36:53 +010024 <link rel="author" title="About these documents" href="../../about.html" />
Gilles Peskine6c723a22020-04-17 16:57:52 +020025 <link rel="index" title="Index" href="../../genindex.html" />
26 <link rel="search" title="Search" href="../../search.html" />
27 <link rel="next" title="Example header file" href="../../appendix/example_header.html" />
Gilles Peskinec2db5f02021-01-18 20:36:53 +010028 <link rel="prev" title="10.9. Key agreement" href="ka.html" />
Gilles Peskine6c723a22020-04-17 16:57:52 +020029
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="other-cryptographic-services">
Gilles Peskinec2db5f02021-01-18 20:36:53 +010044<h1>10.10. Other cryptographic services</h1>
Gilles Peskine6c723a22020-04-17 16:57:52 +020045<div class="section" id="random-number-generation">
Gilles Peskinec2db5f02021-01-18 20:36:53 +010046<span id="rng"></span><h2>10.10.1. Random number generation</h2>
Gilles Peskine6c723a22020-04-17 16:57:52 +020047<div class="section" id="psa_generate_random">
48<span id="c.psa_generate_random"></span><h3><code class="docutils literal"><span class="pre">psa_generate_random</span></code> (function)</h3>
49<p>Generate random bytes.</p>
50<pre class="literal-block">
51<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,
52 size_t output_size);
53</pre>
54<p class="rubric">Parameters</p>
55<dl class="docutils">
56<dt> <code class="docutils literal"><span class="pre">output</span></code></dt>
57<dd>Output buffer for the generated data.</dd>
58<dt> <code class="docutils literal"><span class="pre">output_size</span></code></dt>
59<dd>Number of bytes to generate and output.</dd>
60</dl>
61<p class="rubric">Returns: <a class="reference internal" href="../library/status.html#c.psa_status_t" title="psa_status_t"><code class="docutils literal"><span class="pre">psa_status_t</span></code></a></p>
62<dl class="docutils">
63<dt> <a class="reference internal" href="../library/status.html#c.PSA_SUCCESS" title="PSA_SUCCESS"><code class="docutils literal"><span class="pre">PSA_SUCCESS</span></code></a></dt>
64<dd></dd>
65<dt> <a class="reference internal" href="../library/status.html#c.PSA_ERROR_NOT_SUPPORTED" title="PSA_ERROR_NOT_SUPPORTED"><code class="docutils literal"><span class="pre">PSA_ERROR_NOT_SUPPORTED</span></code></a></dt>
66<dd></dd>
67<dt> <a class="reference internal" href="../library/status.html#c.PSA_ERROR_INSUFFICIENT_ENTROPY" title="PSA_ERROR_INSUFFICIENT_ENTROPY"><code class="docutils literal"><span class="pre">PSA_ERROR_INSUFFICIENT_ENTROPY</span></code></a></dt>
68<dd></dd>
69<dt> <a class="reference internal" href="../library/status.html#c.PSA_ERROR_INSUFFICIENT_MEMORY" title="PSA_ERROR_INSUFFICIENT_MEMORY"><code class="docutils literal"><span class="pre">PSA_ERROR_INSUFFICIENT_MEMORY</span></code></a></dt>
70<dd></dd>
71<dt> <a class="reference internal" href="../library/status.html#c.PSA_ERROR_COMMUNICATION_FAILURE" title="PSA_ERROR_COMMUNICATION_FAILURE"><code class="docutils literal"><span class="pre">PSA_ERROR_COMMUNICATION_FAILURE</span></code></a></dt>
72<dd></dd>
73<dt> <a class="reference internal" href="../library/status.html#c.PSA_ERROR_HARDWARE_FAILURE" title="PSA_ERROR_HARDWARE_FAILURE"><code class="docutils literal"><span class="pre">PSA_ERROR_HARDWARE_FAILURE</span></code></a></dt>
74<dd></dd>
75<dt> <a class="reference internal" href="../library/status.html#c.PSA_ERROR_CORRUPTION_DETECTED" title="PSA_ERROR_CORRUPTION_DETECTED"><code class="docutils literal"><span class="pre">PSA_ERROR_CORRUPTION_DETECTED</span></code></a></dt>
76<dd></dd>
77<dt> <a class="reference internal" href="../library/status.html#c.PSA_ERROR_BAD_STATE" title="PSA_ERROR_BAD_STATE"><code class="docutils literal"><span class="pre">PSA_ERROR_BAD_STATE</span></code></a></dt>
78<dd>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"><span class="pre">psa_crypto_init()</span></code></a>. It is implementation-dependent whether a failure to initialize results in this error code.</dd>
79</dl>
80<p class="rubric">Description</p>
81<div class="admonition warning">
82<p class="first admonition-title">Warning</p>
83<p class="last">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"><span class="pre">PSA_SUCCESS</span></code></a>.</p>
84</div>
85<div class="admonition note">
86<p class="first admonition-title">Note</p>
87<p class="last">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"><span class="pre">psa_generate_key()</span></code></a> instead.</p>
88</div>
89</div>
90</div>
91</div>
92
93
94 </div>
95 </div>
96 </div>
97 <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
Gilles Peskinec2db5f02021-01-18 20:36:53 +010098 <div class="sphinxsidebarwrapper"><h3><a href="../../index.html"><b>PSA Crypto API</b></a></h3>
99IHI 0086<br/>
100Non-confidential<br/>
101Version 1.0.1
102<span style="color: red; font-weight: bold;"></span>
Gilles Peskine6c723a22020-04-17 16:57:52 +0200103<ul>
Gilles Peskinec2db5f02021-01-18 20:36:53 +0100104<li class="toctree-l1"><a class="reference internal" href="../../about.html">About this document</a></li>
Gilles Peskine6c723a22020-04-17 16:57:52 +0200105</ul>
Gilles Peskinec2db5f02021-01-18 20:36:53 +0100106<ul class="current">
107<li class="toctree-l1"><a class="reference internal" href="../../overview/intro.html">1. Introduction</a></li>
108<li class="toctree-l1"><a class="reference internal" href="../../overview/goals.html">2. Design goals</a></li>
109<li class="toctree-l1"><a class="reference internal" href="../../overview/functionality.html">3. Functionality overview</a></li>
110<li class="toctree-l1"><a class="reference internal" href="../../overview/sample-arch.html">4. Sample architectures</a></li>
111<li class="toctree-l1"><a class="reference internal" href="../../overview/conventions.html">5. Library conventions</a></li>
112<li class="toctree-l1"><a class="reference internal" href="../../overview/implementation.html">6. Implementation considerations</a></li>
113<li class="toctree-l1"><a class="reference internal" href="../../overview/usage.html">7. Usage considerations</a></li>
114<li class="toctree-l1"><a class="reference internal" href="../library/index.html">8. Library management reference</a></li>
115<li class="toctree-l1"><a class="reference internal" href="../keys/index.html">9. Key management reference</a></li>
116<li class="toctree-l1 current"><a class="reference internal" href="index.html">10. Cryptographic operation reference</a><ul class="current">
117<li class="toctree-l2"><a class="reference internal" href="algorithms.html">10.1. Algorithms</a></li>
118<li class="toctree-l2"><a class="reference internal" href="hashes.html">10.2. Message digests</a></li>
119<li class="toctree-l2"><a class="reference internal" href="macs.html">10.3. Message authentication codes (MAC)</a></li>
120<li class="toctree-l2"><a class="reference internal" href="ciphers.html">10.4. Unauthenticated ciphers</a></li>
121<li class="toctree-l2"><a class="reference internal" href="aead.html">10.5. Authenticated encryption with associated data (AEAD)</a></li>
122<li class="toctree-l2"><a class="reference internal" href="kdf.html">10.6. Key derivation</a></li>
123<li class="toctree-l2"><a class="reference internal" href="sign.html">10.7. Asymmetric signature</a></li>
124<li class="toctree-l2"><a class="reference internal" href="pke.html">10.8. Asymmetric encryption</a></li>
125<li class="toctree-l2"><a class="reference internal" href="ka.html">10.9. Key agreement</a></li>
126<li class="toctree-l2 current"><a class="current reference internal" href="#">10.10. Other cryptographic services</a><ul>
127<li class="toctree-l3"><a class="reference internal" href="#random-number-generation">10.10.1. Random number generation</a></li>
128</ul>
129</li>
130</ul>
131</li>
132</ul>
133<ul>
134<li class="toctree-l1"><a class="reference internal" href="../../appendix/example_header.html">Example header file</a></li>
135<li class="toctree-l1"><a class="reference internal" href="../../appendix/specdef_values.html">Example macro implementations</a></li>
136<li class="toctree-l1"><a class="reference internal" href="../../appendix/history.html">Changes to the API</a></li>
137</ul>
138<ul>
139<li class="toctree-l1"><a class="reference internal" href="../../psa_c-identifiers.html">Index of API elements</a></li>
140</ul>
Gilles Peskine6c723a22020-04-17 16:57:52 +0200141<div id="searchbox" style="display: none" role="search">
142 <h3>Quick search</h3>
143 <form class="search" action="../../search.html" method="get">
144 <div><input type="text" name="q" /></div>
145 <div><input type="submit" value="Go" /></div>
146 <input type="hidden" name="check_keywords" value="yes" />
147 <input type="hidden" name="area" value="default" />
148 </form>
149</div>
150<script type="text/javascript">$('#searchbox').show(0);</script>
151 </div>
152 </div>
153 <div class="clearer"></div>
154 </div>
155 <div class="footer">
Gilles Peskinec2db5f02021-01-18 20:36:53 +0100156 &copy; 2018-2020, Arm Limited or its affiliates. All rights reserved.
Gilles Peskine6c723a22020-04-17 16:57:52 +0200157
158 |
159 Powered by <a href="http://sphinx-doc.org/">Sphinx 1.6.7</a>
160 &amp; <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.8</a>
161
Gilles Peskine6c723a22020-04-17 16:57:52 +0200162 </div>
163
164
165
166
167 </body>
168</html>