Data Structures | |
struct | shw_hash_state |
Defines | |
#define | SHW_HASH_LEN 32 |
Typedefs | |
typedef struct shw_hash_state | shw_hash_state_t |
Functions | |
fsl_shw_return_t | shw_hash_init (shw_hash_state_t *state, fsl_shw_hash_alg_t algorithm) |
fsl_shw_return_t | shw_hash_update (shw_hash_state_t *state, const uint8_t *msg, unsigned int msg_len) |
fsl_shw_return_t | shw_hash_final (shw_hash_state_t *state, uint8_t *hash, unsigned int hash_len) |
This file contains definitions for use of the (internal) SHW hash 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 hash.
#define SHW_HASH_LEN 32 |
Define which gives the number of bytes available in an hash result
Referenced by shw_hash_final(), and shw_hmac_final().
typedef struct shw_hash_state shw_hash_state_t |
State for a SHA-1/SHA-2 Hash
(Note to maintainers: state needs to be updated to uint64_t to handle SHA-384/SHA-512)... And bit_count to uint128_t (heh).
fsl_shw_return_t shw_hash_final | ( | shw_hash_state_t * | state, | |
uint8_t * | result, | |||
unsigned int | result_len | |||
) |
Calculate the final hash value
state | Address of hash state structure. | |
hash | Address of location to store the hash. | |
hash_len | Number of bytes of hash to be stored. |
Finalize the hash
Performs the finalize operation on the previous input data & returns the resulting digest. The finalize operation performs the appropriate padding up to the block size.
state | Address of hash state structure | |
result | Location to store the hash result | |
result_len | Number of bytes of result to be stored. |
References shw_hash_state::bit_count, FSL_RETURN_BAD_DATA_LENGTH_S, FSL_RETURN_OK_S, shw_hash_state::partial_count_bytes, SHW_HASH_LEN, shw_hash_update(), and shw_hash_state::state.
Referenced by shw_hmac_final().
fsl_shw_return_t shw_hash_init | ( | shw_hash_state_t * | state, | |
fsl_shw_hash_alg_t | alg | |||
) |
Initialize the hash state structure
state | Address of hash state structure. | |
algorithm | Which hash algorithm to use (must be FSL_HASH_ALG_SHA256) |
Initialize the hash state structure
state | Address of hash state structure. | |
alg | Which hash algorithm to use (must be FSL_HASH_ALG_SHA1) |
References FSL_HASH_ALG_SHA256, FSL_RETURN_BAD_ALGORITHM_S, FSL_RETURN_OK_S, and sha256_init().
Referenced by shw_hmac_init().
fsl_shw_return_t shw_hash_update | ( | shw_hash_state_t * | state, | |
const uint8_t * | input, | |||
unsigned int | input_len | |||
) |
Put data into the hash calculation
state | Address of hash state structure. | |
msg | Address of the message data for the hash. | |
msg_len | Number of bytes of msg . |
Add input bytes to the hash
The bytes are added to the partial_block element of the hash state, and as the partial block is filled, it is processed by sha1_process_block(). This function also updates the bit_count element of the hash state.
state | Address of hash state structure | |
input | Address of bytes to add to the hash | |
input_len | Numbef of bytes at input |
References shw_hash_state::bit_count, FSL_RETURN_OK_S, shw_hash_state::partial_block, shw_hash_state::partial_count_bytes, and sha256_process_block().
Referenced by shw_hash_final(), shw_hmac_final(), shw_hmac_init(), and shw_hmac_update().
© Freescale Semiconductor, Inc., 2007.
All rights reserved. Freescale Confidential Proprietary NDA Required |
![]() |