Gilles Peskine | 6c723a2 | 2020-04-17 16:57:52 +0200 | [diff] [blame^] | 1 | |
| 2 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" |
| 3 | "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
| 4 | |
| 5 | <html xmlns="http://www.w3.org/1999/xhtml"> |
| 6 | <head> |
| 7 | <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> |
| 8 | <title>Other cryptographic services — PSA Crypto API 1.0.0 documentation</title> |
| 9 | <link rel="stylesheet" href="../../_static/alabaster.css" type="text/css" /> |
| 10 | <link rel="stylesheet" href="../../_static/pygments.css" type="text/css" /> |
| 11 | <script type="text/javascript"> |
| 12 | var DOCUMENTATION_OPTIONS = { |
| 13 | URL_ROOT: '../../', |
| 14 | VERSION: '1.0.0', |
| 15 | COLLAPSE_INDEX: false, |
| 16 | FILE_SUFFIX: '.html', |
| 17 | HAS_SOURCE: true, |
| 18 | SOURCELINK_SUFFIX: '.txt' |
| 19 | }; |
| 20 | </script> |
| 21 | <script type="text/javascript" src="../../_static/jquery.js"></script> |
| 22 | <script type="text/javascript" src="../../_static/underscore.js"></script> |
| 23 | <script type="text/javascript" src="../../_static/doctools.js"></script> |
| 24 | <link rel="index" title="Index" href="../../genindex.html" /> |
| 25 | <link rel="search" title="Search" href="../../search.html" /> |
| 26 | <link rel="next" title="Example header file" href="../../appendix/example_header.html" /> |
| 27 | <link rel="prev" title="Key agreement" href="ka.html" /> |
| 28 | |
| 29 | <link rel="stylesheet" href="../../_static/custom.css" type="text/css" /> |
| 30 | |
| 31 | <meta name="viewport" content="width=device-width, initial-scale=0.9, maximum-scale=0.9" /> |
| 32 | |
| 33 | </head> |
| 34 | <body> |
| 35 | |
| 36 | |
| 37 | <div class="document"> |
| 38 | <div class="documentwrapper"> |
| 39 | <div class="bodywrapper"> |
| 40 | <div class="body" role="main"> |
| 41 | |
| 42 | <div class="section" id="other-cryptographic-services"> |
| 43 | <h1>Other cryptographic services</h1> |
| 44 | <div class="section" id="random-number-generation"> |
| 45 | <span id="rng"></span><h2>Random number generation</h2> |
| 46 | <div class="section" id="psa_generate_random"> |
| 47 | <span id="c.psa_generate_random"></span><h3><code class="docutils literal"><span class="pre">psa_generate_random</span></code> (function)</h3> |
| 48 | <p>Generate random bytes.</p> |
| 49 | <pre class="literal-block"> |
| 50 | <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, |
| 51 | size_t output_size); |
| 52 | </pre> |
| 53 | <p class="rubric">Parameters</p> |
| 54 | <dl class="docutils"> |
| 55 | <dt> <code class="docutils literal"><span class="pre">output</span></code></dt> |
| 56 | <dd>Output buffer for the generated data.</dd> |
| 57 | <dt> <code class="docutils literal"><span class="pre">output_size</span></code></dt> |
| 58 | <dd>Number of bytes to generate and output.</dd> |
| 59 | </dl> |
| 60 | <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> |
| 61 | <dl class="docutils"> |
| 62 | <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> |
| 63 | <dd></dd> |
| 64 | <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> |
| 65 | <dd></dd> |
| 66 | <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> |
| 67 | <dd></dd> |
| 68 | <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> |
| 69 | <dd></dd> |
| 70 | <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> |
| 71 | <dd></dd> |
| 72 | <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> |
| 73 | <dd></dd> |
| 74 | <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> |
| 75 | <dd></dd> |
| 76 | <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> |
| 77 | <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> |
| 78 | </dl> |
| 79 | <p class="rubric">Description</p> |
| 80 | <div class="admonition warning"> |
| 81 | <p class="first admonition-title">Warning</p> |
| 82 | <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> |
| 83 | </div> |
| 84 | <div class="admonition note"> |
| 85 | <p class="first admonition-title">Note</p> |
| 86 | <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> |
| 87 | </div> |
| 88 | </div> |
| 89 | </div> |
| 90 | </div> |
| 91 | |
| 92 | |
| 93 | </div> |
| 94 | </div> |
| 95 | </div> |
| 96 | <div class="sphinxsidebar" role="navigation" aria-label="main navigation"> |
| 97 | <div class="sphinxsidebarwrapper"> |
| 98 | <h3><a href="../../index.html">Table Of Contents</a></h3> |
| 99 | <ul> |
| 100 | <li><a class="reference internal" href="#">Other cryptographic services</a><ul> |
| 101 | <li><a class="reference internal" href="#random-number-generation">Random number generation</a><ul> |
| 102 | <li><a class="reference internal" href="#psa_generate_random"><code class="docutils literal"><span class="pre">psa_generate_random</span></code> (function)</a></li> |
| 103 | </ul> |
| 104 | </li> |
| 105 | </ul> |
| 106 | </li> |
| 107 | </ul> |
| 108 | <div class="relations"> |
| 109 | <h3>Related Topics</h3> |
| 110 | <ul> |
| 111 | <li><a href="../../index.html">Documentation overview</a><ul> |
| 112 | <li><a href="index.html">Cryptographic operation reference</a><ul> |
| 113 | <li>Previous: <a href="ka.html" title="previous chapter">Key agreement</a></li> |
| 114 | <li>Next: <a href="../../appendix/example_header.html" title="next chapter">Example header file</a></li> |
| 115 | </ul></li> |
| 116 | </ul></li> |
| 117 | </ul> |
| 118 | </div> |
| 119 | <div role="note" aria-label="source link"> |
| 120 | <h3>This Page</h3> |
| 121 | <ul class="this-page-menu"> |
| 122 | <li><a href="../../_sources/api/ops/rng.rst.txt" |
| 123 | rel="nofollow">Show Source</a></li> |
| 124 | </ul> |
| 125 | </div> |
| 126 | <div id="searchbox" style="display: none" role="search"> |
| 127 | <h3>Quick search</h3> |
| 128 | <form class="search" action="../../search.html" method="get"> |
| 129 | <div><input type="text" name="q" /></div> |
| 130 | <div><input type="submit" value="Go" /></div> |
| 131 | <input type="hidden" name="check_keywords" value="yes" /> |
| 132 | <input type="hidden" name="area" value="default" /> |
| 133 | </form> |
| 134 | </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"> |
| 141 | © 2019-2020, Arm Limited or its affiliates. All rights reserved. |
| 142 | |
| 143 | | |
| 144 | Powered by <a href="http://sphinx-doc.org/">Sphinx 1.6.7</a> |
| 145 | & <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.8</a> |
| 146 | |
| 147 | | |
| 148 | <a href="../../_sources/api/ops/rng.rst.txt" |
| 149 | rel="nofollow">Page source</a> |
| 150 | </div> |
| 151 | |
| 152 | |
| 153 | |
| 154 | |
| 155 | </body> |
| 156 | </html> |