![]() |
TrustCore SDK Crypto Interface API reference
version 2.0
|
Cryptographic Interface header file for declaring NIST CTR DRBG functions. More...
Go to the source code of this file.
Functions | |
MOC_EXTERN MSTATUS | CRYPTO_INTERFACE_NIST_CTRDRBG_deleteContext (MOC_SYM(hwAccelDescr hwAccelCtx) randomContext **ppContext) |
Deletes a NIST Counter DRBG type context. More... | |
MOC_EXTERN MSTATUS | CRYPTO_INTERFACE_NIST_CTRDRBG_generate (MOC_SYM(hwAccelDescr hwAccelCtx) randomContext *pContext, const ubyte *pAdditionalInput, ubyte4 additionalInputLen, ubyte *pOutput, ubyte4 outputLenBits) |
Generates determinstic random bits from a previously initialized context. More... | |
MOC_EXTERN MSTATUS | CRYPTO_INTERFACE_NIST_CTRDRBG_generateSecret (MOC_SYM(hwAccelDescr hwAccelCtx) randomContext *pContext, ubyte *pAdditionalInput, ubyte4 additionalInputLen, ubyte *pSecret, ubyte4 secretLen) |
Generates a "secret" which consist of the internal state, ie the V and key, followed by the deterministic random bits that can be generated by that state. More... | |
MOC_EXTERN MSTATUS | CRYPTO_INTERFACE_NIST_CTRDRBG_newContext (MOC_SYM(hwAccelDescr hwAccelCtx) randomContext **ppNewContext, const ubyte *pEntropyInput, ubyte4 keyLenBytes, ubyte4 outLenBytes, const ubyte *pPersonalization, ubyte4 personalizationLen) |
Creates and seeds a new random context of NIST Counter DRBG type with no derivation function. More... | |
MOC_EXTERN MSTATUS | CRYPTO_INTERFACE_NIST_CTRDRBG_newDFContext (MOC_SYM(hwAccelDescr hwAccelCtx) randomContext **ppNewContext, ubyte4 keyLenBytes, ubyte4 outLenBytes, const ubyte *pEntropyInput, ubyte4 entropyInputLen, const ubyte *pNonce, ubyte4 nonceLen, const ubyte *pPersonalization, ubyte4 personalizationLen) |
Creates and seeds a new random context of NIST Counter DRBG type with the derivation function. More... | |
MOC_EXTERN MSTATUS | CRYPTO_INTERFACE_NIST_CTRDRBG_numberGenerator (MOC_SYM(hwAccelDescr hwAccelCtx) randomContext *pContext, ubyte *pOutput, sbyte4 outputLenBytes) |
Generates determinstic random bytes from a previously initialized context. More... | |
MOC_EXTERN MSTATUS | CRYPTO_INTERFACE_NIST_CTRDRBG_reseed (MOC_SYM(hwAccelDescr hwAccelCtx) randomContext *pContext, const ubyte *pEntropyInput, ubyte4 entropyInputLen, const ubyte *pAdditionalInput, ubyte4 additionalInputLen) |
Reseeds a NICE counter DRBG type context. More... | |
MOC_EXTERN MSTATUS | CRYPTO_INTERFACE_NIST_CTRDRBG_setStateFromSecret (MOC_SYM(hwAccelDescr hwAccelCtx) randomContext *pContext, ubyte *pAdditionalInput, ubyte4 additionalInputLen, ubyte *pSecret, ubyte4 secretLen) |
Sets the state of a context to the state within the secret passed in. More... | |
Add details here.
MOC_EXTERN MSTATUS CRYPTO_INTERFACE_NIST_CTRDRBG_deleteContext | ( | MOC_SYM(hwAccelDescr hwAccelCtx) randomContext ** | ppContext | ) |
ppContext | Pointer to the location that holds the context to be deleted. |
OK
(0) if successful, otherwise a negative number error code from merrors.h. MOC_EXTERN MSTATUS CRYPTO_INTERFACE_NIST_CTRDRBG_generate | ( | MOC_SYM(hwAccelDescr hwAccelCtx) randomContext * | pContext, |
const ubyte * | pAdditionalInput, | ||
ubyte4 | additionalInputLen, | ||
ubyte * | pOutput, | ||
ubyte4 | outputLenBits | ||
) |
pContext | Pointer to an initialized randomContext. |
pAdditionalInput | Additional input. This is optional and may be NULL. |
additionalInputLen | The length of the additional input in bytes. |
pOutput | Buffer to hold the resulting deterministic bits. There should be enough space in this buffer to hold the number of requested bits rounded up to the next byte (ie multiple of 8). |
outputLenBits | The number of bits requested. |
OK
(0) if successful, otherwise a negative number error code from merrors.h. MOC_EXTERN MSTATUS CRYPTO_INTERFACE_NIST_CTRDRBG_generateSecret | ( | MOC_SYM(hwAccelDescr hwAccelCtx) randomContext * | pContext, |
ubyte * | pAdditionalInput, | ||
ubyte4 | additionalInputLen, | ||
ubyte * | pSecret, | ||
ubyte4 | secretLen | ||
) |
pContext | Pointer to an initialized randomContext. |
pSecret | Pointer to a buffer that will hold the resulting secret. |
secretLen | The length of the secret you desire. This must be at least the length of the key plus the output length. |
OK
(0) if successful, otherwise a negative number error code from merrors.h. MOC_EXTERN MSTATUS CRYPTO_INTERFACE_NIST_CTRDRBG_newContext | ( | MOC_SYM(hwAccelDescr hwAccelCtx) randomContext ** | ppNewContext, |
const ubyte * | pEntropyInput, | ||
ubyte4 | keyLenBytes, | ||
ubyte4 | outLenBytes, | ||
const ubyte * | pPersonalization, | ||
ubyte4 | personalizationLen | ||
) |
ppNewContext | Pointer to the location that will receive the new context. |
pEntropyInput | The seed. This must be keyLenBytes + outLenBytes in length. |
keyLenBytes | The length of the block cipher key in bytes. This is typically 16, 24, or 32 for AES and 21 for 3DES. |
outLenBytes | The block size of the block cipher, 16 for AES, 8 for 3DES. |
pPersonalization | The personalization string. This is optional and may be NULL. |
personalizationLen | The length of the personalization string in bytes. This may not be bigger than keyLenBytes + outLenBytes. |
OK
(0) if successful, otherwise a negative number error code from merrors.h. MOC_EXTERN MSTATUS CRYPTO_INTERFACE_NIST_CTRDRBG_newDFContext | ( | MOC_SYM(hwAccelDescr hwAccelCtx) randomContext ** | ppNewContext, |
ubyte4 | keyLenBytes, | ||
ubyte4 | outLenBytes, | ||
const ubyte * | pEntropyInput, | ||
ubyte4 | entropyInputLen, | ||
const ubyte * | pNonce, | ||
ubyte4 | nonceLen, | ||
const ubyte * | pPersonalization, | ||
ubyte4 | personalizationLen | ||
) |
ppNewContext | Pointer to the location that will receive the new context. |
keyLenBytes | The length of the block cipher key in bytes. This is typically 16, 24, or 32 for AES and 21 for 3DES. |
outLenBytes | The block size of the block cipher, 16 for AES, 8 for 3DES. |
pEntropyInput | The seed. This is required. |
entropyInputLen | The length of the seed in bytes. |
pNonce | The nonce. This is optional and may be NULL. |
nonceLen | The length of the nonce in bytes. |
pPersonalization | The personalization string. This is optional and may be NULL. |
personalizationLen | The length of the personalization string in bytes. No restriction on this length. |
OK
(0) if successful, otherwise a negative number error code from merrors.h. MOC_EXTERN MSTATUS CRYPTO_INTERFACE_NIST_CTRDRBG_numberGenerator | ( | MOC_SYM(hwAccelDescr hwAccelCtx) randomContext * | pContext, |
ubyte * | pOutput, | ||
sbyte4 | outputLenBytes | ||
) |
This API does not allow the caller to pass in any additional entropy. Use CRYPTO_INTERFACE_NIST_CTRDRBG_generate to pass in additional entropy.
IMPORTANT: This API takes in a byte length for the output buffer as opposed to CRYPTO_INTERFACE_NIST_CTRDRBG_generate which takes in a bit length for the output buffer.
pContext | Pointer to an initialized randomContext. |
pOutput | Buffer to hold the resulting deterministic bytes. There should be enough space in this buffer to hold the number of requested bytes. |
outputLenBytes | The number of bytes requested. |
OK
(0) if successful, otherwise a negative number error code from merrors.h. MOC_EXTERN MSTATUS CRYPTO_INTERFACE_NIST_CTRDRBG_reseed | ( | MOC_SYM(hwAccelDescr hwAccelCtx) randomContext * | pContext, |
const ubyte * | pEntropyInput, | ||
ubyte4 | entropyInputLen, | ||
const ubyte * | pAdditionalInput, | ||
ubyte4 | additionalInputLen | ||
) |
pContext | Pointer to the context to be reseeded. |
pEntropyInput | The new seed. |
entropyInputLen | The length of the new seed in bytes. |
pAdditionalInput | Additional input. This is optional and may be NULL. |
additionalInputLen | The length of the additional input in bytes. |
OK
(0) if successful, otherwise a negative number error code from merrors.h. MOC_EXTERN MSTATUS CRYPTO_INTERFACE_NIST_CTRDRBG_setStateFromSecret | ( | MOC_SYM(hwAccelDescr hwAccelCtx) randomContext * | pContext, |
ubyte * | pAdditionalInput, | ||
ubyte4 | additionalInputLen, | ||
ubyte * | pSecret, | ||
ubyte4 | secretLen | ||
) |
The rest of the secret will be verified that it contains the deterministic bits that can be generated from that state and the state will be incrememted to the next state.
pContext | Pointer to an initialized randomContext. |
pSecret | Pointer to a buffer containing a secret. |
secretLen | The length of the pSecret buffer in bytes. |
OK
(0) if successful, otherwise a negative number error code from merrors.h.