|
| 1 | +.. _hash-drbg-gen: |
| 2 | + |
| 3 | +ippsHashDRBG_Gen |
| 4 | +================= |
| 5 | + |
| 6 | +Generates a pseudorandom unsigned 32-bit integer buffer of the specified bit length. |
| 7 | + |
| 8 | +Syntax |
| 9 | +------ |
| 10 | + |
| 11 | +.. code:: cpp |
| 12 | +
|
| 13 | + IppStatus ippsHashDRBG_Gen(Ipp32u* pRand, |
| 14 | + int nBits, |
| 15 | + const int requestedSecurityStrength, |
| 16 | + const int predictionResistanceRequest, |
| 17 | + const Ipp8u* addlInput, |
| 18 | + const int addlInputBitsLen, |
| 19 | + IppsHashDRBG_EntropyInputCtx* pEntrInputCtx, |
| 20 | + IppsHashDRBGState* pDrbgCtx); |
| 21 | +
|
| 22 | +Include Files |
| 23 | +------------- |
| 24 | + |
| 25 | +``ippcp.h`` |
| 26 | + |
| 27 | +Parameters |
| 28 | +---------- |
| 29 | + |
| 30 | +.. list-table:: |
| 31 | + :header-rows: 0 |
| 32 | + |
| 33 | + * - pRand |
| 34 | + - Pointer to the output pseudorandom unsigned integer buffer. |
| 35 | + * - nBits |
| 36 | + - Requested number of bits to be generated. |
| 37 | + * - requestedSecurityStrength |
| 38 | + - The security strength to be associated with the requested pseudorandom bits. |
| 39 | + * - predictionResistanceRequest |
| 40 | + - Indicates whether or not prediction resistance is to be provided during the request |
| 41 | + (whether or not fresh entropy bits are required). |
| 42 | + * - addlInput |
| 43 | + - Pointer to the array containing additional input (optional). |
| 44 | + * - addlInputBitsLen |
| 45 | + - Length of the ``addlInput`` in bits (may be zero). |
| 46 | + * - pEntrInputCtx |
| 47 | + - Pointer to the Entropy input context. |
| 48 | + The size is equal to the value returned by ``ippsHashDRBG_EntropyInputCtxGetSize``. |
| 49 | + * - pDrbgCtx |
| 50 | + - Pointer to the ``IppsHashDRBGState`` context. |
| 51 | + Size equals to the value returned by ``ippsHashDRBG_GetSize``. |
| 52 | + |
| 53 | +Description |
| 54 | +----------- |
| 55 | + |
| 56 | +The ``ippsHashDRBG_Gen`` function: |
| 57 | + |
| 58 | +- Calls the reseed function to incorporate fresh entropy when prediction resistance is requested or |
| 59 | + the Hash DRBG has reached the end of its reseed interval. |
| 60 | + |
| 61 | +- Generates a pseudorandom unsigned integer big number of the specified ``nBits`` length and updates the working state. |
| 62 | + |
| 63 | +Return Values |
| 64 | +------------- |
| 65 | + |
| 66 | +.. list-table:: |
| 67 | + :header-rows: 0 |
| 68 | + |
| 69 | + * - ippStsNoErr |
| 70 | + - Indicates no error. All single operations executed without errors. |
| 71 | + Any other value indicates an error. |
| 72 | + * - ippStsNullPtrErr |
| 73 | + - ``pRand``, ``pDrbgCtx`` or ``pEntrInputCtx`` is a NULL pointer. |
| 74 | + The pointer to the buffer that contains the entropy input is NULL. |
| 75 | + * - ippStsContextMatchErr |
| 76 | + - If the Hash DRBG identifier doesn't match. |
| 77 | + If the Entropy input context identifier doesn't match. |
| 78 | + * - ippStsBadArgErr |
| 79 | + - Prediction resistance is requested, but ``predictionResistanceFlag`` has been set to 0 during the initialization of `pDrbgCtx` state. |
| 80 | + The ``nBits`` exceeds the maximum possible number of bits per request or the maximum possible value. |
| 81 | + The ``addlInput`` is NULL with non-zero ``addlInputBitsLen``, or the ``addlInput`` is not NULL, but ``addlInputBitsLen`` is 0. |
| 82 | + * - ippStsOutOfRangeErr |
| 83 | + - The length of the ``addlInput`` exceeds the maximum possible value. |
| 84 | + The length for the entropy input, passed to the getEntropyInput callback function, is less than the *security strength* |
| 85 | + or exceeds the length of the entropy input buffer. |
| 86 | + * - ippStsNotSupportedModeErr |
| 87 | + - The CPU does not support the ``RDSEED`` and/or ``RDRAND`` instructions. |
| 88 | + * - ippStsHashOperationErr |
| 89 | + - An error status code was returned during hashing operations. |
0 commit comments