Data Structures | |
struct | shw_hmac_state |
Typedefs | |
typedef struct shw_hmac_state | shw_hmac_state_t |
Functions | |
fsl_shw_return_t | shw_hmac_init (shw_hmac_state_t *state, const uint8_t *key, unsigned int key_len) |
fsl_shw_return_t | shw_hmac_update (shw_hmac_state_t *state, const uint8_t *msg, unsigned int msg_len) |
fsl_shw_return_t | shw_hmac_final (shw_hmac_state_t *state, uint8_t *hmac, unsigned int hmac_len) |
This file contains definitions for use of the (internal) SHW HMAC software computation. It defines the usual three steps:
The only other item of note to callers is SHW_HASH_LEN, which is the number of bytes calculated for the HMAC.
typedef struct shw_hmac_state shw_hmac_state_t |
State for an HMAC
Note to callers: This structure contains key material and should be kept in a secure location, such as internal RAM.
fsl_shw_return_t shw_hmac_final | ( | shw_hmac_state_t * | state, | |
uint8_t * | hmac, | |||
unsigned int | hmac_len | |||
) |
Calculate the final HMAC
state | Address of HMAC state structure. | |
hmac | Address of location to store the HMAC. | |
hmac_len | Number of bytes of mac to be stored. Probably best if this value is no greater than SHW_HASH_LEN. |
Calculate the final HMAC
state | Address of HMAC state structure. | |
hmac | Address of location to store the HMAC. | |
hmac_len | Number of bytes of mac to be stored. Probably best if this value is no greater than SHW_HASH_LEN. |
This function finalizes the internal hash, and uses that result as data for the outer hash. As many bytes of that result are passed to the user as desired.
References FSL_RETURN_OK_S, shw_hmac_state::inner_hash, shw_hmac_state::outer_hash, shw_hash_final(), SHW_HASH_LEN, and shw_hash_update().
fsl_shw_return_t shw_hmac_init | ( | shw_hmac_state_t * | state, | |
const uint8_t * | key, | |||
unsigned int | key_len | |||
) |
Initialize the HMAC state structure with the HMAC key
state | Address of HMAC state structure. | |
key | Address of the key to be used for the HMAC. | |
key_len | Number of bytes of key . This must not be greater than the block size of the underlying hash (SHW_HASH_BLOCK_LEN). |
Initialize the HMAC state structure with the HMAC key
state | Address of HMAC state structure | |
key | Address of the key to be used for the HMAC. | |
key_len | Number of bytes of key . |
Convert the key into its equivalent inner and outer hash state objects.
References FSL_HASH_ALG_SHA256, FSL_RETURN_BAD_KEY_LENGTH_S, FSL_RETURN_ERROR_S, FSL_RETURN_OK_S, shw_hmac_state::inner_hash, INNER_HASH_CONSTANT, shw_hmac_state::outer_hash, OUTER_HASH_CONSTANT, shw_hash_init(), and shw_hash_update().
fsl_shw_return_t shw_hmac_update | ( | shw_hmac_state_t * | state, | |
const uint8_t * | msg, | |||
unsigned int | msg_len | |||
) |
Put data into the HMAC calculation
state | Address of HMAC state structure. | |
msg | Address of the message data for the HMAC. | |
msg_len | Number of bytes of msg . |
Put data into the HMAC calculation
Send the msg data inner inner hash's update function.
state | Address of HMAC state structure. | |
msg | Address of the message data for the HMAC. | |
msg_len | Number of bytes of msg . |
References FSL_RETURN_OK_S, shw_hmac_state::inner_hash, and shw_hash_update().
© Freescale Semiconductor, Inc., 2007.
All rights reserved. Freescale Confidential Proprietary NDA Required |
![]() |