![]() |
TrustCore SDK Crypto Interface API reference
version 2.0
|
Cryptographic Interface header file for declaring HMAC functions. More...
Go to the source code of this file.
Functions | |
MOC_EXTERN MSTATUS | CRYPTO_INTERFACE_HMAC_MD5 (MOC_HASH(hwAccelDescr hwAccelCtx) const ubyte *pKey, sbyte4 keyLen, const ubyte *pText, sbyte4 textLen, const ubyte *pTextOpt, sbyte4 textOptLen, ubyte pResult[MD5_DIGESTSIZE]) |
MOC_EXTERN MSTATUS | CRYPTO_INTERFACE_HMAC_MD5_quick (MOC_HASH(hwAccelDescr hwAccelCtx) const ubyte *pKey, sbyte4 keyLen, const ubyte *pText, sbyte4 textLen, ubyte *pResult) |
MOC_EXTERN MSTATUS | CRYPTO_INTERFACE_HMAC_SHA1 (MOC_HASH(hwAccelDescr hwAccelCtx) const ubyte *pKey, sbyte4 keyLen, const ubyte *pText, sbyte4 textLen, const ubyte *pTextOpt, sbyte4 textOptLen, ubyte pResult[SHA_HASH_RESULT_SIZE]) |
MOC_EXTERN MSTATUS | CRYPTO_INTERFACE_HMAC_SHA1_96 (MOC_HASH(hwAccelDescr hwAccelCtx) const ubyte *pKey, sbyte4 keyLen, const ubyte *pText, sbyte4 textLen, const ubyte *pTextOpt, sbyte4 textOptLen, ubyte *pResult) |
Computes a hmac-sha1 truncated to 96 bits. More... | |
MOC_EXTERN MSTATUS | CRYPTO_INTERFACE_HMAC_SHA1_quick (MOC_HASH(hwAccelDescr hwAccelCtx) const ubyte *pKey, sbyte4 keyLen, const ubyte *pText, sbyte4 textLen, ubyte *pResult) |
MOC_EXTERN MSTATUS | CRYPTO_INTERFACE_HMAC_SHA1Ex (MOC_HASH(hwAccelDescr hwAccelCtx) const ubyte *pKey, sbyte4 keyLen, const ubyte *ppTexts[], sbyte4 pTextLens[], sbyte4 numTexts, ubyte pResult[SHA_HASH_RESULT_SIZE]) |
MOC_EXTERN MSTATUS | CRYPTO_INTERFACE_HMAC_SHA256 (MOC_HASH(hwAccelDescr hwAccelCtx) const ubyte *pKey, sbyte4 keyLen, const ubyte *pText, sbyte4 textLen, const ubyte *pTextOpt, sbyte4 textOptLen, ubyte pResult[SHA256_RESULT_SIZE]) |
MOC_EXTERN MSTATUS | CRYPTO_INTERFACE_HMAC_SHA512 (MOC_HASH(hwAccelDescr hwAccelCtx) const ubyte *pKey, sbyte4 keyLen, const ubyte *pText, sbyte4 textLen, const ubyte *pTextOpt, sbyte4 textOptLen, ubyte pResult[SHA512_RESULT_SIZE]) |
MOC_EXTERN MSTATUS | CRYPTO_INTERFACE_HmacCloneCtx (MOC_HASH(hwAccelDescr hwAccelCtx) HMAC_CTX **ppDest, HMAC_CTX *pSrc) |
Allocates and makes a clone of a HMAC_CTX . More... | |
MOC_EXTERN MSTATUS | CRYPTO_INTERFACE_HmacCreate (MOC_HASH(hwAccelDescr hwAccelCtx) HMAC_CTX **ppCtx, const BulkHashAlgo *pBHAlgo) |
Create HMAC context. More... | |
MOC_EXTERN MSTATUS | CRYPTO_INTERFACE_HmacDelete (MOC_HASH(hwAccelDescr hwAccelCtx) HMAC_CTX **ppCtx) |
Delete (free) HMAC context. More... | |
MOC_EXTERN MSTATUS | CRYPTO_INTERFACE_HmacFinal (MOC_HASH(hwAccelDescr hwAccelCtx) HMAC_CTX *pCtx, ubyte *pResult) |
Get final HMAC value. More... | |
MOC_EXTERN MSTATUS | CRYPTO_INTERFACE_HmacKey (MOC_HASH(hwAccelDescr hwAccelCtx) HMAC_CTX *pCtx, const ubyte *pKey, ubyte4 keyLen) |
Insert and process HMAC context's key. More... | |
MOC_EXTERN MSTATUS | CRYPTO_INTERFACE_HmacQuick (MOC_HASH(hwAccelDescr hwAccelCtx) const ubyte *pKey, sbyte4 keyLen, const ubyte *pText, sbyte4 textLen, ubyte *pResult, const BulkHashAlgo *pBHAlgo) |
Calculate HMAC (with a single function call). More... | |
MOC_EXTERN MSTATUS | CRYPTO_INTERFACE_HmacQuicker (MOC_HASH(hwAccelDescr hwAccelCtx) const ubyte *pKey, sbyte4 keyLen, const ubyte *pText, sbyte4 textLen, ubyte *pResult, const BulkHashAlgo *pBHAlgo, HMAC_CTX *pCtx) |
MOC_EXTERN MSTATUS | CRYPTO_INTERFACE_HmacQuickerEx (MOC_HASH(hwAccelDescr hwAccelCtx) const ubyte *pKey, sbyte4 keyLen, const ubyte *pText, sbyte4 textLen, const ubyte *pOptText, ubyte4 optTextLen, ubyte *pResult, const BulkHashAlgo *pBHAlgo, HMAC_CTX *pCtx) |
MOC_EXTERN MSTATUS | CRYPTO_INTERFACE_HmacQuickerInline (MOC_HASH(hwAccelDescr hwAccelCtx) const ubyte *pKey, sbyte4 keyLen, const ubyte *pText, sbyte4 textLen, ubyte *pResult, const BulkHashAlgo *pBHAlgo, BulkCtx pContext) |
MOC_EXTERN MSTATUS | CRYPTO_INTERFACE_HmacQuickerInlineEx (MOC_HASH(hwAccelDescr hwAccelCtx) const ubyte *pKey, sbyte4 keyLen, const ubyte *pText, sbyte4 textLen, const ubyte *pOptText, sbyte4 optTextLen, ubyte *pResult, const BulkHashAlgo *pBHAlgo, BulkCtx pContext) |
MOC_EXTERN MSTATUS | CRYPTO_INTERFACE_HmacQuickEx (MOC_HASH(hwAccelDescr hwAccelCtx) const ubyte *pKey, sbyte4 keyLen, const ubyte *pText, sbyte4 textLen, const ubyte *pOptText, ubyte4 optTextLen, ubyte *pResult, const BulkHashAlgo *pBHAlgo) |
Calculate HMAC (with a single function call) for a message with extended data. More... | |
MOC_EXTERN MSTATUS | CRYPTO_INTERFACE_HmacReset (MOC_HASH(hwAccelDescr hwAccelCtx) HMAC_CTX *pCtx) |
Reset HMAC context. More... | |
MOC_EXTERN MSTATUS | CRYPTO_INTERFACE_HmacSingle (MOC_HASH(hwAccelDescr hwAccelCtx) HMAC_CTX *pCtx, const ubyte *pText, sbyte4 textLen, ubyte *pResult) |
Calculate HMAC with a single function call, using a prekeyed HMAC ctx. More... | |
MOC_EXTERN MSTATUS | CRYPTO_INTERFACE_HmacUpdate (MOC_HASH(hwAccelDescr hwAccelCtx) HMAC_CTX *pCtx, const ubyte *pData, ubyte4 dataLen) |
Update intermediate HMAC value. More... | |
Add details here.
MOC_EXTERN MSTATUS CRYPTO_INTERFACE_HMAC_SHA1_96 | ( | MOC_HASH(hwAccelDescr hwAccelCtx) const ubyte * | pKey, |
sbyte4 | keyLen, | ||
const ubyte * | pText, | ||
sbyte4 | textLen, | ||
const ubyte * | pTextOpt, | ||
sbyte4 | textOptLen, | ||
ubyte * | pResult | ||
) |
Computes a hmac-sha1 truncated to 96 bits.
pKey | Bufere holding the hmac key. |
keyLen | The length of the key in bytes. |
pText | The input data. |
textLen | The length of the input data in bytes. |
pTextOpt | Optional additional input data. |
textOptLen | The length of the optional input data in bytes. |
pResult | Buffer that will be filled with the resulting mac. This must be at least 12 bytes in length. |
OK
(0) if successful, otherwise a negative number error code from merrors.h. MOC_EXTERN MSTATUS CRYPTO_INTERFACE_HmacCloneCtx | ( | MOC_HASH(hwAccelDescr hwAccelCtx) HMAC_CTX ** | ppDest, |
HMAC_CTX * | pSrc | ||
) |
Allocates and makes a clone of a HMAC_CTX
. Make sure to call CRYPTO_INTERFACE_HmacDelete
when finished with the new context.
ppDest | Location that will recieve a pointer to a newly allocated context. |
pSrc | Pointer to the context to be copied. |
OK
(0) if successful, otherwise a negative number error code from merrors.h. MOC_EXTERN MSTATUS CRYPTO_INTERFACE_HmacCreate | ( | MOC_HASH(hwAccelDescr hwAccelCtx) HMAC_CTX ** | ppCtx, |
const BulkHashAlgo * | pBHAlgo | ||
) |
This function creates an HMAC context and initializes data structure fields (function pointers) related to the hash function to be used within HMAC operations.
To avoid memory leaks, your application code must call the HmacDelete() function after HMAC-related operations (because the HMAC context is dynamically allocated by this function during context creation).
FIPS Approved | ![]() |
Suite B Algorithm | ![]() |
Flowchart | HMAC-SHA* |
There are no flag dependencies to enable this function.
hmac.h
hwAccelCtx | If a hardware acceleration flag is defined, this macro expands to an additional parameter, "hwAccelDescr hwAccelCtx". Otherwise, this macro resolves to nothing. |
ppCtx | On return, pointer to resultant HMAC context. |
pBHAlgo | On return, pointer to collection of hash routines to be used within HMAC. |
OK
(0) if successful; otherwise a negative number error code definition from merrors.h. To retrieve a string containing an English text error identifier corresponding to the function's returned error status, use the DISPLAY_ERROR
macro.hmac.c
MOC_EXTERN MSTATUS CRYPTO_INTERFACE_HmacDelete | ( | MOC_HASH(hwAccelDescr hwAccelCtx) HMAC_CTX ** | ppCtx | ) |
This function deletes (frees) an HMAC context. Your application should call this function as soon as it is done using an HMAC context created by HmacCreate().
FIPS Approved | ![]() |
Suite B Algorithm | ![]() |
Flowchart | HMAC-SHA* |
There are no flag dependencies to enable this function.
hmac.h
hwAccelCtx | If a hardware acceleration flag is defined, this macro expands to an additional parameter, "hwAccelDescr hwAccelCtx". Otherwise, this macro resolves to nothing. |
ppCtx | Pointer to HMAC context to delete. |
OK
(0) if successful; otherwise a negative number error code definition from merrors.h. To retrieve a string containing an English text error identifier corresponding to the function's returned error status, use the DISPLAY_ERROR
macro.hmac.c
MOC_EXTERN MSTATUS CRYPTO_INTERFACE_HmacFinal | ( | MOC_HASH(hwAccelDescr hwAccelCtx) HMAC_CTX * | pCtx, |
ubyte * | pResult | ||
) |
This function calculates a final HMAC value, and returns it through the result
parameter.
result
parameter is large enough: at least equal to the output size of the underlying hash function (for example, 20 bytes for SHA1). Otherwise, buffer overflow will occur.FIPS Approved | ![]() |
Suite B Algorithm | ![]() |
Flowchart | HMAC-SHA* |
There are no flag dependencies to enable this function.
hmac.h
hwAccelCtx | If a hardware acceleration flag is defined, this macro expands to an additional parameter, "hwAccelDescr hwAccelCtx". Otherwise, this macro resolves to nothing. |
pCtx | Pointer to HMAC context. |
pResult | On return, pointer to resultant HMAC value. (The calling function must allocate sufficient memory for the result: at least equal to the output size of the underlying hash function — for example, 20 bytes for SHA1. Otherwise buffer overflow will occur.) |
OK
(0) if successful; otherwise a negative number error code definition from merrors.h. To retrieve a string containing an English text error identifier corresponding to the function's returned error status, use the DISPLAY_ERROR
macro.hmac.c
MOC_EXTERN MSTATUS CRYPTO_INTERFACE_HmacKey | ( | MOC_HASH(hwAccelDescr hwAccelCtx) HMAC_CTX * | pCtx, |
const ubyte * | pKey, | ||
ubyte4 | keyLen | ||
) |
This function inserts and processes an HMAC context's key. After calling this function, your application should call HmacUpdate().
FIPS Approved | ![]() |
Suite B Algorithm | ![]() |
Flowchart | HMAC-SHA* |
There are no flag dependencies to enable this function.
hmac.h
hwAccelCtx | If a hardware acceleration flag is defined, this macro expands to an additional parameter, "hwAccelDescr hwAccelCtx". Otherwise, this macro resolves to nothing. |
pCtx | Pointer to HMAC context. |
pKey | Pointer to HMAC key to insert. |
keyLen | Number of bytes in HMAC key (key ). |
OK
(0) if successful; otherwise a negative number error code definition from merrors.h. To retrieve a string containing an English text error identifier corresponding to the function's returned error status, use the DISPLAY_ERROR
macro.hmac.c
MOC_EXTERN MSTATUS CRYPTO_INTERFACE_HmacQuick | ( | MOC_HASH(hwAccelDescr hwAccelCtx) const ubyte * | pKey, |
sbyte4 | keyLen, | ||
const ubyte * | pText, | ||
sbyte4 | textLen, | ||
ubyte * | pResult, | ||
const BulkHashAlgo * | pBHAlgo | ||
) |
This function completely calculates an HMAC, with no need to call multiple, "separate steps" methods. Before calling this function, allocate and assign the desired algorithm values to the pBHAlgo
parameter. (Using values for SHA1 is the equivalent to calling the HMAC_SHA1() function.) The resultant HMAC value is returned through the pResult
parameter.
result
parameter is large enough: at least equal to the output size of the underlying hash function (for example, 20 bytes for SHA1). Otherwise, buffer overflow will occur.FIPS Approved | ![]() |
Suite B Algorithm | ![]() |
Flowchart | HMAC-MD5, HMAC-SHA* |
There are no flag dependencies to enable this function.
hmac.h
hwAccelCtx | If a hardware acceleration flag is defined, this macro expands to an additional parameter, "hwAccelDescr hwAccelCtx". Otherwise, this macro resolves to nothing. |
pKey | Pointer to HMAC key to insert. |
keyLen | Number of bytes in HMAC key (pKey ). |
pText | Pointer to input data. |
textLen | Number of bytes of input data (pText ). |
pResult | On return, pointer to resultant HMAC value. (The calling function must allocate sufficient memory for the result: at least equal to the output size of the underlying hash function — for example, 20 bytes for SHA1. Otherwise buffer overflow will occur.) |
pBHAlgo | Pointer to collection of hash routines used within HMAC. (Refer to crypto.h for the structure definition.) |
OK
(0) if successful; otherwise a negative number error code definition from merrors.h. To retrieve a string containing an English text error identifier corresponding to the function's returned error status, use the DISPLAY_ERROR
macro.hmac.c
MOC_EXTERN MSTATUS CRYPTO_INTERFACE_HmacQuickEx | ( | MOC_HASH(hwAccelDescr hwAccelCtx) const ubyte * | pKey, |
sbyte4 | keyLen, | ||
const ubyte * | pText, | ||
sbyte4 | textLen, | ||
const ubyte * | pOptText, | ||
ubyte4 | optTextLen, | ||
ubyte * | pResult, | ||
const BulkHashAlgo * | pBHAlgo | ||
) |
This function completely calculates an HMAC for a message with extended data, with no need to call multiple, "separate steps" methods. Before calling this function, allocate and assign the desired algorithm values to the pBHAlgo
parameter. (Using values for SHA1 is the equivalent to calling the HMAC_SHA1() function.) The resultant HMAC value is returned through the pResult
parameter.
result
parameter is large enough: at least equal to the output size of the underlying hash function (for example, 20 bytes for SHA1). Otherwise, buffer overflow will occur.FIPS Approved | ![]() |
Suite B Algorithm | ![]() |
Flowchart | HMAC-MD5, HMAC-SHA* |
There are no flag dependencies to enable this function.
hmac.h
hwAccelCtx | If a hardware acceleration flag is defined, this macro expands to an additional parameter, "hwAccelDescr hwAccelCtx". Otherwise, this macro resolves to nothing. |
pKey | Pointer to HMAC key to insert. |
keyLen | Number of bytes in HMAC key (pKey ). |
pText | Pointer to input data. |
textLen | Number of bytes of input data (pText ). |
pOptText | Pointer to optional (extended) input data to append after (pText ); may be NULL to indicate none (which makes this function equivalent to the HmacQuick() function). |
optTextLen | Number of bytes of optional input data (pOptText ); may be zero to indicate none. |
pResult | On return, pointer to resultant HMAC value. (The calling function must allocate sufficient memory for the result: at least equal to the output size of the underlying hash function — for example, 20 bytes for SHA1. Otherwise buffer overflow will occur.) |
pBHAlgo | Pointer to collection of hash routines used within HMAC. (Refer to crypto.h for the structure definition.) |
OK
(0) if successful; otherwise a negative number error code definition from merrors.h. To retrieve a string containing an English text error identifier corresponding to the function's returned error status, use the DISPLAY_ERROR
macro.hmac.c
MOC_EXTERN MSTATUS CRYPTO_INTERFACE_HmacReset | ( | MOC_HASH(hwAccelDescr hwAccelCtx) HMAC_CTX * | pCtx | ) |
This function resets an HMAC context.
FIPS Approved | ![]() |
Suite B Algorithm | ![]() |
Flowchart | HMAC-SHA* |
There are no flag dependencies to enable this function.
hmac.h
hwAccelCtx | If a hardware acceleration flag is defined, this macro expands to an additional parameter, "hwAccelDescr hwAccelCtx". Otherwise, this macro resolves to nothing. |
pCtx | Pointer to HMAC context. |
OK
(0) if successful; otherwise a negative number error code definition from merrors.h. To retrieve a string containing an English text error identifier corresponding to the function's returned error status, use the DISPLAY_ERROR
macro.hmac.c
MOC_EXTERN MSTATUS CRYPTO_INTERFACE_HmacSingle | ( | MOC_HASH(hwAccelDescr hwAccelCtx) HMAC_CTX * | pCtx, |
const ubyte * | pText, | ||
sbyte4 | textLen, | ||
ubyte * | pResult | ||
) |
This function completely calculates an HMAC, with no need to call multiple, "separate steps" methods. Before calling this function, allocate and assign the desired algorithm values to the pBHAlgo
parameter. (Using values for SHA1 is the equivalent to calling the HMAC_SHA1() function.) The resultant HMAC value is returned through the pResult
parameter.
result
parameter is large enough: at least equal to the output size of the underlying hash function (for example, 20 bytes for SHA1). Otherwise, buffer overflow will occur.FIPS Approved | ![]() |
Suite B Algorithm | ![]() |
Flowchart | HMAC-MD5, HMAC-SHA* |
There are no flag dependencies to enable this function.
hmac.h
hwAccelCtx | If a hardware acceleration flag is defined, this macro expands to an additional parameter, "hwAccelDescr hwAccelCtx". Otherwise, this macro resolves to nothing. |
pCtx | Pointer to previously created and keyed HMAC ctx. |
pText | Pointer to input data. |
textLen | Number of bytes of input data (pText ). |
pResult | On return, pointer to resultant HMAC value. (The calling function must allocate sufficient memory for the result: at least equal to the output size of the underlying hash function — for example, 20 bytes for SHA1. Otherwise buffer overflow will occur.) |
OK
(0) if successful; otherwise a negative number error code definition from merrors.h. To retrieve a string containing an English text error identifier corresponding to the function's returned error status, use the DISPLAY_ERROR
macro.hmac.c
MOC_EXTERN MSTATUS CRYPTO_INTERFACE_HmacUpdate | ( | MOC_HASH(hwAccelDescr hwAccelCtx) HMAC_CTX * | pCtx, |
const ubyte * | pData, | ||
ubyte4 | dataLen | ||
) |
This function updates the intermediate HMAC value in an HMAC context. Applications can repeatedly call this function to calculate an HMAC for different data items.
FIPS Approved | ![]() |
Suite B Algorithm | ![]() |
Flowchart | HMAC-SHA* |
There are no flag dependencies to enable this function.
hmac.h
hwAccelCtx | If a hardware acceleration flag is defined, this macro expands to an additional parameter, "hwAccelDescr hwAccelCtx". Otherwise, this macro resolves to nothing. |
pCtx | Pointer to HMAC context. |
pData | Pointer to input data. |
dataLen | Number of bytes of input data (text ). |
OK
(0) if successful; otherwise a negative number error code definition from merrors.h. To retrieve a string containing an English text error identifier corresponding to the function's returned error status, use the DISPLAY_ERROR
macro.hmac.c