TrustCore SDK Crypto Interface API reference  version 2.0
crypto_interface_hmac_kdf.h File Reference

Cryptographic Interface header file for declaring HMAC-KDF functions. More...

Go to the source code of this file.

Functions

MOC_EXTERN MSTATUS CRYPTO_INTERFACE_HmacKdfExpand (MOC_HASH(hwAccelDescr hwAccelCtx) const BulkHashAlgo *pDigest, ubyte *pPseudoRandomKey, ubyte4 pseudoRandomKeyLen, ubyte *pContext, ubyte4 contextLen, ubyte *pIv, ubyte4 ivLen, ubyte *pOutput, ubyte4 keyLength)
 Perform the expand operation for Hmac KDF. More...
 
MOC_EXTERN MSTATUS CRYPTO_INTERFACE_HmacKdfExpandExt (MOC_HASH(hwAccelDescr hwAccelCtx) const BulkHashAlgo *pDigest, ubyte *pPseudoRandomKey, ubyte4 pseudoRandomKeyLen, ubyte *pContext, ubyte4 contextLen, ubyte *pIv, ubyte4 ivLen, ubyte *pOutput, ubyte4 keyLength, void *pExtCtx)
 Perform the expand operation for Hmac KDF. More...
 
MOC_EXTERN MSTATUS CRYPTO_INTERFACE_HmacKdfExtract (MOC_HASH(hwAccelDescr hwAccelCtx) const BulkHashAlgo *pDigest, ubyte *pSalt, ubyte4 saltLen, ubyte *pInputKeyMaterial, ubyte4 inputKeyMaterialLen, ubyte *pOutput, ubyte4 outputLen)
 Perform the extract operation for Hmac KDF. More...
 
MOC_EXTERN MSTATUS CRYPTO_INTERFACE_HmacKdfExtractExt (MOC_HASH(hwAccelDescr hwAccelCtx) const BulkHashAlgo *pDigest, ubyte *pSalt, ubyte4 saltLen, ubyte *pInputKeyMaterial, ubyte4 inputKeyMaterialLen, ubyte *pOutput, ubyte4 outputLen, void *pExtCtx)
 Perform the extract operation for Hmac KDF. More...
 

Detailed Description

Function Documentation

◆ CRYPTO_INTERFACE_HmacKdfExpand()

MOC_EXTERN MSTATUS CRYPTO_INTERFACE_HmacKdfExpand ( MOC_HASH(hwAccelDescr hwAccelCtx) const BulkHashAlgo *  pDigest,
ubyte *  pPseudoRandomKey,
ubyte4  pseudoRandomKeyLen,
ubyte *  pContext,
ubyte4  contextLen,
ubyte *  pIv,
ubyte4  ivLen,
ubyte *  pOutput,
ubyte4  keyLength 
)

This function will take in the psuedo random key generated from the extract step and generate key material bits. There is an optional context which can be passed in.

Parameters
pDigestThe digest suite used for the Hmac operations.
pPseudoRandomKeyThis is the psuedo random key of at least digest length bytes. This is usually the pseudo random key from the extract step.
pseudoRandomKeyLenThe length of the psuedo random key. Must be at least digest length in bytes.
pContextOptional context information specific to the application.
contextLenThe length of the context in bytes.
pIVThe 'initial value' byte array. Can be NULL when 'ivLen' is zero (0).
ivLenThe length of the 'initial vector' in bytes. Is allowed to be zero.
pOutputThe output buffer where the keying material will be deposited.
keyLengthThis parameter it the amount of key material bytes that the caller is requesting. It cannot exceed 255 multiplied by the digest size.
Returns
OK (0) if successful, otherwise a negative number error code from merrors.h.

◆ CRYPTO_INTERFACE_HmacKdfExpandExt()

MOC_EXTERN MSTATUS CRYPTO_INTERFACE_HmacKdfExpandExt ( MOC_HASH(hwAccelDescr hwAccelCtx) const BulkHashAlgo *  pDigest,
ubyte *  pPseudoRandomKey,
ubyte4  pseudoRandomKeyLen,
ubyte *  pContext,
ubyte4  contextLen,
ubyte *  pIv,
ubyte4  ivLen,
ubyte *  pOutput,
ubyte4  keyLength,
void *  pExtCtx 
)

This function will take in the psuedo random key generated from the extract step and generate key material bits. There is an optional context which can be passed in.

Parameters
pDigestThe digest suite used for the Hmac operations.
pPseudoRandomKeyThis is the psuedo random key of at least digest length bytes. This is usually the pseudo random key from the extract step.
pseudoRandomKeyLenThe length of the psuedo random key. Must be at least digest length in bytes.
pContextOptional context information specific to the application.
contextLenThe length of the context in bytes.
pIVThe 'initial value' byte array. Can be NULL when 'ivLen' is zero (0).
ivLenThe length of the 'initial vector' in bytes. Is allowed to be zero.
pOutputThe output buffer where the keying material will be deposited.
keyLengthThe size of the output buffer. Must have at least keyLength bytes.
pExtCtxAn extended context reserved for future use.
Returns
OK (0) if successful, otherwise a negative number error code from merrors.h.

◆ CRYPTO_INTERFACE_HmacKdfExtract()

MOC_EXTERN MSTATUS CRYPTO_INTERFACE_HmacKdfExtract ( MOC_HASH(hwAccelDescr hwAccelCtx) const BulkHashAlgo *  pDigest,
ubyte *  pSalt,
ubyte4  saltLen,
ubyte *  pInputKeyMaterial,
ubyte4  inputKeyMaterialLen,
ubyte *  pOutput,
ubyte4  outputLen 
)

This function will take in the input key material as well as an optional salt value and generate a pseudo random key bits. Note that the output of the psuedo random key will be the size of the digest output of the digest functions provided as input.

IMPORTANT: Do not use the output of the extract function as actual key material. The output material should be passed into the Hmac KDF expand method.

Parameters
pDigestThe digest suite used for the Hmac operations.
pSaltOptional salt value. Providing a salt value is recommended. The salt value should ideally be a random or pseudorandom value of digest length.
saltLenThe length of the salt buffer.
pInputKeyMaterialThe input keying material. This is keying material which may be non-uniformly distributed, and the caller wants to create a "stronger" or more evenly dispersed key. The key material can be any length.
inputKeyMaterialLenThe length of the key material which can be any length.
pOutputThe output buffer. This is where the pseudo random key will be placed. Note that the key should not be used as actual key material. The key will be digest length in size (Based on the digest suite passed in by the caller).
outputLenThe size of the output buffer.
Returns
OK (0) if successful, otherwise a negative number error code from merrors.h.

◆ CRYPTO_INTERFACE_HmacKdfExtractExt()

MOC_EXTERN MSTATUS CRYPTO_INTERFACE_HmacKdfExtractExt ( MOC_HASH(hwAccelDescr hwAccelCtx) const BulkHashAlgo *  pDigest,
ubyte *  pSalt,
ubyte4  saltLen,
ubyte *  pInputKeyMaterial,
ubyte4  inputKeyMaterialLen,
ubyte *  pOutput,
ubyte4  outputLen,
void *  pExtCtx 
)

This function will take in the input key material as well as an optional salt value and generate a pseudo random key bits. Note that the output of the psuedo random key will be the size of the digest output of the digest functions provided as input.

IMPORTANT: Do not use the output of the extract function as actual key material. The output material should be passed into the Hmac KDF expand method.

Parameters
pDigestThe digest suite used for the Hmac operations.
pSaltOptional salt value. Providing a salt value is recommended. The salt value should ideally be a random or pseudorandom value of digest length.
saltLenThe length of the salt buffer.
pInputKeyMaterialThe input keying material. This is keying material which may be non-uniformly distributed, and the caller wants to create a "stronger" or more evenly dispersed key. The key material can be any length.
inputKeyMaterialLenThe length of the key material which can be any length.
pOutputThe output buffer. This is where the pseudo random key will be placed. Note that the key should not be used as actual key material. The key will be digest length in size (Based on the digest suite passed in by the caller).
outputLenThe size of the output buffer.
pExtCtxAn extended context reserved for future use.
Returns
OK (0) if successful, otherwise a negative number error code from merrors.h.