Defines | |
#define | INNER_HASH_CONSTANT 0x36 |
#define | OUTER_HASH_CONSTANT 0x5C |
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 implementations for use of the (internal) SHW HMAC software computation. It defines the usual three steps:
#define INNER_HASH_CONSTANT 0x36 |
XOR value for HMAC inner key
Referenced by shw_hmac_init().
#define OUTER_HASH_CONSTANT 0x5C |
XOR value for HMAC outer key
Referenced by shw_hmac_init().
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. |
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 . |
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
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 |
![]() |