ibm-information-center/dist/eclipse/plugins/i5OS.ic.apis_5.4.0.1/qc3genprns.htm

248 lines
6.4 KiB
HTML
Raw Normal View History

2024-04-02 14:02:31 +00:00
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Copyright" content="Copyright (c) 2006 by IBM Corporation">
<!-- Begin Header Records -->
<!-- All rights reserved. Licensed Materials Property of IBM -->
<!-- US Government Users Restricted Rights -->
<!-- Use, duplication or disclosure restricted by -->
<!-- GSA ADP Schedule Contract with IBM Corp. -->
<!-- Created by Beth Hagemeister for V5R1 -->
<!-- Change history: -->
<!-- 010629 File cleanup -->
<!-- 030127 V5R3 hag: Add OPM entry -->
<!-- Miscellaneous API -->
<!-- end header records -->
<title>Generate Psuedorandom Numbers (Qc3GenPRNs) API</title>
<link rel="stylesheet" type="text/css" href="../rzahg/ic.css">
</head>
<body>
<a name="Top_Of_Page"></a>
<!-- Java sync-link -->
<script type="text/javascript" language="Javascript" src="../rzahg/synch.js">
</script>
<h2>Generate Pseudorandom Numbers (QC3GENRN, Qc3GenPRNs) API</h2>
<div class="box" style="width: 80%;">
<br>
&nbsp;&nbsp;Required Parameter Group:<br>
<!-- iddvc RMBR -->
<br>
<table width="100%">
<tr>
<td align="center" valign="top" width="10%">1</td>
<td align="left" valign="top" width="50%">PRN data</td>
<td align="left" valign="top" width="20%">Output</td>
<td align="left" valign="top" width="20%">Char(*)</td>
</tr>
<tr>
<td align="center" valign="top">2</td>
<td align="left" valign="top">PRN data length</td>
<td align="left" valign="top">Input</td>
<td align="left" valign="top">Binary(4)</td>
</tr>
<tr>
<td align="center" valign="top">3</td>
<td align="left" valign="top">PRN type</td>
<td align="left" valign="top">Input</td>
<td align="left" valign="top">Char(1)</td>
</tr>
<tr>
<td align="center" valign="top">4</td>
<td align="left" valign="top">PRN Parity</td>
<td align="left" valign="top">Input</td>
<td align="left" valign="top">Char(1)</td>
</tr>
<tr>
<td align="center" valign="top">5</td>
<td align="left" valign="top">Error code</td>
<td align="left" valign="top">I/O</td>
<td align="left" valign="top">Char(*)</td>
</tr>
</table>
<br>
&nbsp;&nbsp;Service Program Name: QC3PRNG<br>
<!-- iddvc RMBR -->
<br>
&nbsp;&nbsp;Default Public Authority: *USE<br>
<!-- iddvc RMBR -->
<br>
&nbsp;&nbsp;Threadsafe: Yes<br>
<!-- iddvc RMBR -->
<br>
</div>
<p>The Generate Pseudorandom Numbers (OPM, QC3GENRN; ILE, Qc3GenPRNs) API generates a
pseudorandom binary stream.</p>
<p>The pseudorandom number generator is composed of two parts: pseudorandom
number generation and seed management. Pseudorandom number generation is
performed using the FIPS 186-1 algorithm. Cryptographically-secure pseudorandom
numbers rely on good seed. The FIPS 186-1 key and seed values are obtained from
the system seed digest. The server automatically generates seed using data
collected from system information or by using the random number generator
function on a cryptographic coprocessor, such as a 4758, if one is available.
System-generated seed can never be truly unpredictable. If a cryptographic
coprocessor is not available, you can use the Add Seed for PRNG
(Qc3AddPRNGSeed) API to add your own random seed to the system seed digest.
This should be done as soon as possible any time the Licensed Internal Code is
installed.</p>
<br>
<h3>Authorities and Locks</h3>
<p>None.</p>
<br>
<h3>Required Parameter Group</h3>
<dl>
<dt><strong>PRN data</strong></dt>
<dd>OUTPUT; CHAR(*)
<p>The generated pseudorandom binary stream.</p>
</dd>
<dt><strong>PRN data length</strong></dt>
<dd>INPUT; BINARY(4)
<p>The number of pseudorandom number bytes to return in the PRN data parameter.
If 0 is specified, no pseudorandom numbers are returned.</p>
</dd>
<dt><strong>PRN type</strong></dt>
<dd>INPUT; CHAR(1)
<p>The API can generate a real pseudorandom binary stream or a test binary
stream.</p>
<p>The FIPS 186-1 algorithm obtains the inital key and seed values from the
system seed digest when generating a real pseudorandom binary stream. When
generating a test binary stream, the algorithm uses preset values for the key
and seed. Valid values are:</p>
<table width="100%">
<tr>
<td align="left" valign="top" width="5%"><em>0</em></td>
<td align="left" valign="top" width="95%">Generate real pseudorandom
numbers.</td>
</tr>
<tr>
<td align="left" valign="top"><em>1</em></td>
<td align="left" valign="top">Generate test pseudorandom numbers.</td>
</tr>
</table>
<br>
</dd>
<dt><strong>PRN Parity</strong></dt>
<dd>INPUT; CHAR(1)
<p>The API sets each byte of the pseudorandom number binary stream to the
specified parity by altering the low order bit in each byte as necessary. Valid
values are:</p>
<table width="100%">
<tr>
<td align="left" valign="top" width="5%"><em>0</em></td>
<td align="left" valign="top" width="95%">Do not set parity.</td>
</tr>
<tr>
<td align="left" valign="top"><em>1</em></td>
<td align="left" valign="top">Set each byte to odd parity.</td>
</tr>
<tr>
<td align="left" valign="top"><em>2</em></td>
<td align="left" valign="top">Set each byte to even parity.</td>
</tr>
</table>
<br>
</dd>
<dt><strong>Error code</strong></dt>
<dd>I/O; CHAR(*)
<p>The structure in which to return error information. For the format of the
structure, see <a href="../apiref/error.htm#hdrerrcod">Error Code Parameter</a>.</p>
</dd>
</dl>
<br>
<h3>Error Messages</h3>
<table width="100%">
<tr>
<th align="left" valign="top">Message ID</th>
<th align="left" valign="top">Error Message Text</th>
</tr>
<tr>
<td width="15%" valign="top">CPF3C19 E</td>
<td width="85%" valign="top">Error occurred with receiver variable
specified.</td>
</tr>
<tr>
<td valign="top">CPF3CF1 E</td>
<td valign="top">Error code parameter not valid.</td>
</tr>
<tr>
<td valign="top">CPFBAF1 E</td>
<td valign="top">PRN type not valid.</td>
</tr>
<tr>
<td valign="top">CPFBAF2 E</td>
<td valign="top">Parity not valid.</td>
</tr>
<tr>
<td valign="top">CPFBAF3 E</td>
<td valign="top">The system seed digest is not ready.</td>
</tr>
</table>
<br>
<hr>
API introduced: V5R1
<hr>
<center>
<table cellpadding="2" cellspacing="2">
<tr align="center">
<td valign="middle" align="center"><a href="#top">Top</a> | <a href=
"misc1.htm">Miscellaneous APIs</a> | <a href="aplist.htm">APIs by
category</a></td>
</tr>
</table>
</center>
</body>
</html>