![]() |
TrustCore SDK NanoCrypto API reference
version 7.0
|
Header file for the NanoCrypto NIST Deterministic Random Bit Generator. More...
Go to the source code of this file.
Typedefs | |
typedef MSTATUS(* | DrbgHashMethod) (ubyte *pInput, ubyte4 inputLen, ubyte *pOutput) |
Function pointer type for a method that hashes input data in one shot. More... | |
Functions | |
MOC_EXTERN MSTATUS | NIST_HASHDRBG_deleteContext (MOC_SYM(hwAccelDescr hwAccelCtx) NIST_HASH_DRBG_Ctx **ppContext) |
Deletes a hash drbg context. More... | |
MOC_EXTERN MSTATUS | NIST_HASHDRBG_generate (MOC_SYM(hwAccelDescr hwAccelCtx) NIST_HASH_DRBG_Ctx *pContext, ubyte *pAdditionalInput, ubyte4 additionalInputLen, ubyte *pOutput, ubyte4 outputLenBytes) |
Generates deterministic bits from a seeded drbg hash context with an additional data input option. More... | |
MOC_EXTERN MSTATUS | NIST_HASHDRBG_newSeededContext (MOC_SYM(hwAccelDescr hwAccelCtx) NIST_HASH_DRBG_Ctx **ppNewContext, ubyte *pEntropyInput, ubyte4 entropyInputLen, ubyte *pNonce, ubyte4 nonceLen, ubyte *pPersonalization, ubyte4 personalizationLen, DrbgHashMethod hashMethod, ubyte4 hashOutLenBytes) |
Allocates and seeds a new hash drbg context. More... | |
MOC_EXTERN MSTATUS | NIST_HASHDRBG_numberGenerator (MOC_SYM(hwAccelDescr hwAccelCtx) NIST_HASH_DRBG_Ctx *pRandomContext, ubyte *pBuffer, sbyte4 bufferLen) |
Generates deterministic bits from a seeded drbg hash context. More... | |
MOC_EXTERN MSTATUS | NIST_HASHDRBG_reSeed (MOC_SYM(hwAccelDescr hwAccelCtx) NIST_HASH_DRBG_Ctx *pContext, ubyte *pEntropyInput, ubyte4 entropyInputLen, ubyte *pAdditionalInput, ubyte4 additionalInputLen) |
Reseeds a previously existing hash drbg context. More... | |
MOC_EXTERN sbyte4 | NIST_HASHDRBG_rngFun (MOC_SYM(hwAccelDescr hwAccelCtx) void *pRngFunArg, ubyte4 length, ubyte *pBuffer) |
Generates deterministic bits in an RNGFun function pointer form. More... | |
Header file for the NanoCrypto NIST Deterministic Random Bit Generator.
To enable this file's methods define the following flag:
__ENABLE_MOCANA_NIST_DRBG_HASH__
typedef MSTATUS(* DrbgHashMethod) (ubyte *pInput, ubyte4 inputLen, ubyte *pOutput) |
Function pointer type for a method that hashes input data in one shot.
pInput | Buffer holding the input data. |
inputLen | The length of the input data in bytes. |
pOutput | Buffer to hold the resulting output. |
To enable this method define the following flag:
__ENABLE_MOCANA_NIST_DRBG_HASH__
OK
(0) if successful and non-zero if unsuccessful.MOC_EXTERN MSTATUS NIST_HASHDRBG_deleteContext | ( | MOC_SYM(hwAccelDescr hwAccelCtx) NIST_HASH_DRBG_Ctx ** | ppContext | ) |
Zeroes and frees memory allocated for a hash drbg context.
ppContext | Pointer to the location of the context to be deleted. |
To enable this method define the following flag:
__ENABLE_MOCANA_NIST_DRBG_HASH__
OK
(0) if successful; otherwise a negative number error code definition from merrors.h.MOC_EXTERN MSTATUS NIST_HASHDRBG_generate | ( | MOC_SYM(hwAccelDescr hwAccelCtx) NIST_HASH_DRBG_Ctx * | pContext, |
ubyte * | pAdditionalInput, | ||
ubyte4 | additionalInputLen, | ||
ubyte * | pOutput, | ||
ubyte4 | outputLenBytes | ||
) |
Generates deterministic bits from a seeded drbg hash context with an additional data input option. The number of bits requested and output will actually be measured in bytes.
pContext | Pointer to a previously seeded context. |
pAdditionalInput | Optional. Buffer holding additional input data as a byte array. |
additionalInputLen | The length of the additional input data in bytes. |
pOutput | Buffer to hold the resulting output bytes. |
outputLenBytes | The number of output bytes requested. |
To enable this method define the following flag:
__ENABLE_MOCANA_NIST_DRBG_HASH__
OK
(0) if successful; otherwise a negative number error code definition from merrors.h.MOC_EXTERN MSTATUS NIST_HASHDRBG_newSeededContext | ( | MOC_SYM(hwAccelDescr hwAccelCtx) NIST_HASH_DRBG_Ctx ** | ppNewContext, |
ubyte * | pEntropyInput, | ||
ubyte4 | entropyInputLen, | ||
ubyte * | pNonce, | ||
ubyte4 | nonceLen, | ||
ubyte * | pPersonalization, | ||
ubyte4 | personalizationLen, | ||
DrbgHashMethod | hashMethod, | ||
ubyte4 | hashOutLenBytes | ||
) |
Allocates and seeds a new hash drbg context. Please be sure to call NIST_HASHDRBG_deleteContext
to free this context when done with it.
ppNewContext | Pointer to the location that will receive the newly allocated and seeded context. |
pEntropyInput | Buffer of input entropy (also known as the seed). |
entropyInputLen | The length of the input entropy in bytes. |
pNonce | Optional. Buffer holding the nonce as a byte array. |
nonceLen | The length of the nonce in bytes. |
pPersonalization | Optional. Buffer holding the personalization data as a byte array. |
personalizationLen | The length of the personalization data in bytes. |
hashMethod | Function pointer to the hashing method to be used. |
hashOutLenBytes | The output length of the hashMethod chosen. |
To enable this method define the following flag:
__ENABLE_MOCANA_NIST_DRBG_HASH__
OK
(0) if successful; otherwise a negative number error code definition from merrors.h.MOC_EXTERN MSTATUS NIST_HASHDRBG_numberGenerator | ( | MOC_SYM(hwAccelDescr hwAccelCtx) NIST_HASH_DRBG_Ctx * | pRandomContext, |
ubyte * | pBuffer, | ||
sbyte4 | bufferLen | ||
) |
Generates deterministic bits from a seeded drbg hash context. The number of bits requested and output will actually be measured in bytes. For generating bits from additional input use NIST_HASHDRBG_generate
instead.
pContext | Pointer to a previously seeded context. |
pOutput | Buffer to hold the resulting output bytes. |
outputLenBytes | The number of output bytes requested. |
To enable this method define the following flag:
__ENABLE_MOCANA_NIST_DRBG_HASH__
OK
(0) if successful; otherwise a negative number error code definition from merrors.h.MOC_EXTERN MSTATUS NIST_HASHDRBG_reSeed | ( | MOC_SYM(hwAccelDescr hwAccelCtx) NIST_HASH_DRBG_Ctx * | pContext, |
ubyte * | pEntropyInput, | ||
ubyte4 | entropyInputLen, | ||
ubyte * | pAdditionalInput, | ||
ubyte4 | additionalInputLen | ||
) |
Reseeds a previously existing hash drbg context.
pContext | Pointer to the context to be reseeded. |
pEntropyInput | Buffer of input entropy (also known as the seed). |
entropyInputLen | The length of the input entropy in bytes. |
pAdditionalInput | Optional. Buffer holding additional input data as a byte array. |
additionalInputLen | The length of the additional input data in bytes. |
To enable this method define the following flag:
__ENABLE_MOCANA_NIST_DRBG_HASH__
OK
(0) if successful; otherwise a negative number error code definition from merrors.h.MOC_EXTERN sbyte4 NIST_HASHDRBG_rngFun | ( | MOC_SYM(hwAccelDescr hwAccelCtx) void * | pRngFunArg, |
ubyte4 | length, | ||
ubyte * | pBuffer | ||
) |
Generates deterministic bits in an RNGFun
function pointer form. Please see random.h for a description of this form. The number of bits requested and output will actually be measured in bytes.
pRngFunArg | Pointer to a previously seeded hash drbg context. |
length | The number of output bytes requested. |
pBuffer | Buffer to hold the resulting output bytes. |
To enable this method define the following flag:
__ENABLE_MOCANA_NIST_DRBG_HASH__
OK
(0) if successful; otherwise a negative number error code definition from merrors.h.