This file contains all of the enums and definitions that are used for the CRYS HMAC APIs, as well as the APIs themselves. More...
Data Structures | |
struct | CRYS_HMACUserContext_t |
Macros | |
#define | CRYS_HMAC_KEY_SIZE_IN_BYTES 64 |
#define | CRYS_HMAC_SHA2_1024BIT_KEY_SIZE_IN_BYTES 128 |
Typedefs | |
typedef struct CRYS_HMACUserContext_t | CRYS_HMACUserContext_t |
Functions | |
CRYSError_t | CRYS_HMAC_Init (CRYS_HMACUserContext_t *ContextID_ptr, CRYS_HASH_OperationMode_t OperationMode, uint8_t *key_ptr, uint16_t keySize) |
This function initializes the HMAC machine. More... | |
CRYSError_t | CRYS_HMAC_Update (CRYS_HMACUserContext_t *ContextID_ptr, uint8_t *DataIn_ptr, size_t DataInSize) |
This function processes a block of data to be HASHed. More... | |
CRYSError_t | CRYS_HMAC_Finish (CRYS_HMACUserContext_t *ContextID_ptr, CRYS_HASH_Result_t HmacResultBuff) |
This function finalizes the HMAC processing of a data block. More... | |
CRYSError_t | CRYS_HMAC_Free (CRYS_HMACUserContext_t *ContextID_ptr) |
This function is a service function that frees the context if the operation has failed. More... | |
CRYSError_t | CRYS_HMAC (CRYS_HASH_OperationMode_t OperationMode, uint8_t *key_ptr, uint16_t keySize, uint8_t *DataIn_ptr, size_t DataSize, CRYS_HASH_Result_t HmacResultBuff) |
This function processes a single buffer of data, and returns the data buffer's message digest. More... | |
This file contains all of the enums and definitions that are used for the CRYS HMAC APIs, as well as the APIs themselves.
HMAC is a wrapping algorithm that uses a HASH function (one of the supported HASH algorithms, as specified in the HASH chapter) and a key, to generate a unique authentication code over the input data. HMAC calculation can be performed in either of the following two modes of operation:
The following is a typical HMAC Block operation flow:
CRYSError_t CRYS_HMAC | ( | CRYS_HASH_OperationMode_t | OperationMode, |
uint8_t * | key_ptr, | ||
uint16_t | keySize, | ||
uint8_t * | DataIn_ptr, | ||
size_t | DataSize, | ||
CRYS_HASH_Result_t | HmacResultBuff | ||
) |
This function processes a single buffer of data, and returns the data buffer's message digest.
[in] | OperationMode | One of the supported HASH modes, as defined in CRYS_HASH_OperationMode_t. |
[in] | key_ptr | The pointer to the user's key buffer. |
[in] | keySize | The key size in bytes. |
[in] | DataIn_ptr | Pointer to the input data to be HASHed. The size of the scatter/gather list representing the data buffer is limited to 128 entries, and the size of each entry is limited to 64KB (fragments larger than 64KB are broken into fragments <= 64KB). |
[in] | DataSize | The size of the data to be hashed (in bytes). |
[out] | HmacResultBuff | Pointer to the word-aligned 64 byte buffer. The actual size of the HMAC result depends on CRYS_HASH_OperationMode_t. |
CRYSError_t CRYS_HMAC_Finish | ( | CRYS_HMACUserContext_t * | ContextID_ptr, |
CRYS_HASH_Result_t | HmacResultBuff | ||
) |
This function finalizes the HMAC processing of a data block.
It receives a handle to the HMAC context that was previously initialized by CRYS_HMAC_Init, or by CRYS_HMAC_Update. It completes the HASH calculation on the ipad and text, and then executes a new HASH operation with the key XOR opad and the previous HASH operation result.
[in] | ContextID_ptr | Pointer to the HMAC context buffer allocated by the user, which is used for the HMAC machine operation. |
[out] | HmacResultBuff | Pointer to the word-aligned 64 byte buffer. The actual size of the HASH result depends on CRYS_HASH_OperationMode_t. |
CRYSError_t CRYS_HMAC_Free | ( | CRYS_HMACUserContext_t * | ContextID_ptr | ) |
This function is a service function that frees the context if the operation has failed.
The function executes the following major steps:
[in] | ContextID_ptr | Pointer to the HMAC context buffer allocated by the user, which is used for the HMAC machine operation. |
CRYSError_t CRYS_HMAC_Init | ( | CRYS_HMACUserContext_t * | ContextID_ptr, |
CRYS_HASH_OperationMode_t | OperationMode, | ||
uint8_t * | key_ptr, | ||
uint16_t | keySize | ||
) |
This function initializes the HMAC machine.
It allocates and initializes the HMAC Context. It initiates a HASH session and processes a HASH update on the Key XOR ipad, then stores it in the context
[in] | ContextID_ptr | Pointer to the HMAC context buffer allocated by the user, which is used for the HMAC machine operation. |
[in] | OperationMode | One of the supported HASH modes, as defined in CRYS_HASH_OperationMode_t. |
[in] | key_ptr | The pointer to the user's key buffer. |
[in] | keySize | The key size in bytes. |
CRYSError_t CRYS_HMAC_Update | ( | CRYS_HMACUserContext_t * | ContextID_ptr, |
uint8_t * | DataIn_ptr, | ||
size_t | DataInSize | ||
) |
This function processes a block of data to be HASHed.
It receives a handle to the HMAC Context, and updates the HASH value with the new data.
[in] | ContextID_ptr | Pointer to the HMAC context buffer allocated by the user that is used for the HMAC machine operation. |
[in] | DataIn_ptr | Pointer to the input data to be HASHed. The size of the scatter/gather list representing the data buffer is limited to 128 entries, and the size of each entry is limited to 64KB (fragments larger than 64KB are broken into fragments <= 64KB). |
[in] | DataInSize | Byte size of the input data. Must be > 0. If not a multiple of the HASH block size (64 for SHA-1 and SHA-224/256, 128 for SHA-384/512), no further calls to CRYS_HMAC_Update are allowed in this context, and only CRYS_HMAC_Finish can be called to complete the computation. |