Implementation of the RNGs described in NIST 800-90A nist_rng.h.
More...
Go to the source code of this file.
|
MOC_EXTERN MSTATUS | NIST_CTRDRBG_deleteContext (MOC_SYM(hwAccelDescr hwAccelCtx) randomContext **ppNewContext) |
| Clear and free a previously instantiated CTRDRBG context. More...
|
|
MOC_EXTERN MSTATUS | NIST_CTRDRBG_generate (MOC_SYM(hwAccelDescr hwAccelCtx) randomContext *pContext, const ubyte *additionalInput, ubyte4 additionalInputLen, ubyte *output, ubyte4 outputLenBits) |
| Generate random data with optional additional input. More...
|
|
MOC_EXTERN MSTATUS | NIST_CTRDRBG_newContext (MOC_SYM(hwAccelDescr hwAccelCtx) randomContext **ppNewContext, const ubyte *entropyInput, ubyte4 keyLenBytes, ubyte4 outLenBytes, const ubyte *personalization, ubyte4 personalizationLen) |
| Allocate and initialize a new CTRDRBG context that is not using a derivation function. More...
|
|
MOC_EXTERN MSTATUS | NIST_CTRDRBG_newDFContext (MOC_SYM(hwAccelDescr hwAccelCtx) randomContext **ppNewContext, ubyte4 keyLenBytes, ubyte4 outLenBytes, const ubyte *entropyInput, ubyte4 entropyInputLen, const ubyte *nonce, ubyte4 nonceLen, const ubyte *personalization, ubyte4 personalizationLen) |
| Allocate and initialize a new CTRDRBG context that is using a derivation function. More...
|
|
MOC_EXTERN MSTATUS | NIST_CTRDRBG_numberGenerator (MOC_SYM(hwAccelDescr hwAccelCtx) randomContext *pRandomContext, ubyte *pBuffer, sbyte4 bufSize) |
| Generate random data. More...
|
|
MOC_EXTERN MSTATUS | NIST_CTRDRBG_reseed (MOC_SYM(hwAccelDescr hwAccelCtx) randomContext *pContext, const ubyte *entropyInput, ubyte4 entropyInputLen, const ubyte *additionalInput, ubyte4 additionalInputLen) |
| Reseed a previously instantiated CTRDRBG context. More...
|
|
MOC_EXTERN sbyte4 | NIST_CTRDRBG_rngFun (MOC_SYM(hwAccelDescr hwAccelCtx) void *rngFunArg, ubyte4 length, ubyte *buffer) |
| Callback function to generate random data. More...
|
|
MOC_EXTERN void | resetDRBGFail (void) |
|
MOC_EXTERN void | triggerDRBGFail (void) |
|
Copyright 2019-2024 DigiCert, Inc. All Rights Reserved. Proprietary and Confidential Material.
◆ NIST_CTRDRBG_deleteContext()
MOC_EXTERN MSTATUS NIST_CTRDRBG_deleteContext |
( |
MOC_SYM(hwAccelDescr hwAccelCtx) randomContext ** |
ppNewContext | ) |
|
- Parameters
-
ppNewContext | Pointer to the context to be freed. |
- Returns
OK
(0) if successful; otherwise a negative number error code definition from merrors.h.
◆ NIST_CTRDRBG_generate()
MOC_EXTERN MSTATUS NIST_CTRDRBG_generate |
( |
MOC_SYM(hwAccelDescr hwAccelCtx) randomContext * |
pContext, |
|
|
const ubyte * |
additionalInput, |
|
|
ubyte4 |
additionalInputLen, |
|
|
ubyte * |
output, |
|
|
ubyte4 |
outputLenBits |
|
) |
| |
- Parameters
-
pContext | Context to use to generate the random data. |
additionalInput | Optional additional input to use for the reseed. |
additionalInputLen | Length in bytes of the additional input. |
output | Pointer to the caller allocated output buffer. |
outputLenBits | Length in bits of random data to generate. |
- Returns
OK
(0) if successful; otherwise a negative number error code definition from merrors.h.
◆ NIST_CTRDRBG_newContext()
MOC_EXTERN MSTATUS NIST_CTRDRBG_newContext |
( |
MOC_SYM(hwAccelDescr hwAccelCtx) randomContext ** |
ppNewContext, |
|
|
const ubyte * |
entropyInput, |
|
|
ubyte4 |
keyLenBytes, |
|
|
ubyte4 |
outLenBytes, |
|
|
const ubyte * |
personalization, |
|
|
ubyte4 |
personalizationLen |
|
) |
| |
This function implements the CTR_DRBG_Instantiate_algorithm described in NIST SP 800-90A Rev1 10.2.1.3.1
- Parameters
-
ppNewContext | Pointer to the address that will recieve the newly allocated context. |
entropyInput | Entropy to seed this DRBG with. Must be equal to the block length + key length. |
keyLenBytes | Length in bytes of the key material to use, sets the security strength of the DRBG. For example 16 for AES-128 and 32 for AES-256. |
outLenBytes | Block length of the underlying block cipher to be used for this CTRDRBG instantiation. Must be 8 to use triple DES or 16 to use AES. |
personalization | Optional personalization string. |
personalizationLen | Length in bytes of the personalization string. |
- Returns
OK
(0) if successful; otherwise a negative number error code definition from merrors.h.
◆ NIST_CTRDRBG_newDFContext()
MOC_EXTERN MSTATUS NIST_CTRDRBG_newDFContext |
( |
MOC_SYM(hwAccelDescr hwAccelCtx) randomContext ** |
ppNewContext, |
|
|
ubyte4 |
keyLenBytes, |
|
|
ubyte4 |
outLenBytes, |
|
|
const ubyte * |
entropyInput, |
|
|
ubyte4 |
entropyInputLen, |
|
|
const ubyte * |
nonce, |
|
|
ubyte4 |
nonceLen, |
|
|
const ubyte * |
personalization, |
|
|
ubyte4 |
personalizationLen |
|
) |
| |
This function implements the CTR_DRBG_Instantiate_algorithm described in NIST SP 800-90A Rev1 10.2.1.3.2
- Parameters
-
ppNewContext | Pointer to the address that will recieve the newly allocated context. |
keyLenBytes | Length in bytes of the key material to use, sets the security strength of the DRBG. For example 16 for AES-128 and 32 for AES-256. |
outLenBytes | Block length of the underlying block cipher to be used for this CTRDRBG instantiation. Must be 8 to use triple DES or 16 to use AES. |
entropyInput | Entropy to seed this DRBG with. |
entropyInputLen | Length in bytes of the entropy material. Must be sufficient to support the given key length, see NIST SP 800-90A Rev1 10.2.1 Table 3 for more info. |
nonce | Optional nonce. |
nonceLen | Length in bytes of the nonce. |
personalization | Optional personalization string. |
personalizationLen | Length in bytes of the personalization string. |
- Returns
OK
(0) if successful; otherwise a negative number error code definition from merrors.h.
◆ NIST_CTRDRBG_numberGenerator()
MOC_EXTERN MSTATUS NIST_CTRDRBG_numberGenerator |
( |
MOC_SYM(hwAccelDescr hwAccelCtx) randomContext * |
pRandomContext, |
|
|
ubyte * |
pBuffer, |
|
|
sbyte4 |
bufSize |
|
) |
| |
- Parameters
-
pContext | Context to use to generate the random data. |
pBuffer | Pointer to the caller allocated output buffer. |
bufSize | Length in bytes of random data to generate. |
- Returns
OK
(0) if successful; otherwise a negative number error code definition from merrors.h.
◆ NIST_CTRDRBG_reseed()
MOC_EXTERN MSTATUS NIST_CTRDRBG_reseed |
( |
MOC_SYM(hwAccelDescr hwAccelCtx) randomContext * |
pContext, |
|
|
const ubyte * |
entropyInput, |
|
|
ubyte4 |
entropyInputLen, |
|
|
const ubyte * |
additionalInput, |
|
|
ubyte4 |
additionalInputLen |
|
) |
| |
- Parameters
-
pContext | Context to be reseeded. |
entropyInput | Entropy input to use for this reseed. |
entropyInputLen | Length in bytes of the input entropy material. See NIST SP 800-90A Rev1 10.2.1 Table 3 for more info. |
additionalInput | Optional additional input to use for the reseed. |
additionalInputLen | Length in bytes of the additional input. |
- Returns
OK
(0) if successful; otherwise a negative number error code definition from merrors.h.
◆ NIST_CTRDRBG_rngFun()
MOC_EXTERN sbyte4 NIST_CTRDRBG_rngFun |
( |
MOC_SYM(hwAccelDescr hwAccelCtx) void * |
rngFunArg, |
|
|
ubyte4 |
length, |
|
|
ubyte * |
buffer |
|
) |
| |
There are many functions that take in a RNG callback to get random data, this function is a wrapper to fit the callback signature.
- Parameters
-
rngFunArg | Argument to the callback, in practice it is typically a CTRDRBG context. |
length | Length in bytes of random data to generate. |
buffer | Pointer to the caller allocated output buffer. |
- Returns
OK
(0) if successful; otherwise a negative number error code definition from merrors.h.