This section describes the programming interface of the LTC HASH driver.
|
status_t | LTC_HASH_Init (LTC_Type *base, ltc_hash_ctx_t *ctx, ltc_hash_algo_t algo, const uint8_t *key, uint32_t keySize) |
| Initialize HASH context. More...
|
|
status_t | LTC_HASH_Update (ltc_hash_ctx_t *ctx, const uint8_t *input, uint32_t inputSize) |
| Add data to current HASH. More...
|
|
status_t | LTC_HASH_Finish (ltc_hash_ctx_t *ctx, uint8_t *output, uint32_t *outputSize) |
| Finalize hashing. More...
|
|
status_t | LTC_HASH (LTC_Type *base, ltc_hash_algo_t algo, const uint8_t *input, uint32_t inputSize, const uint8_t *key, uint32_t keySize, uint8_t *output, uint32_t *outputSize) |
| Create HASH on given data. More...
|
|
#define LTC_HASH_CTX_SIZE 29 |
Enumerator |
---|
kLTC_XcbcMac |
XCBC-MAC (AES engine)
|
kLTC_Cmac |
CMAC (AES engine)
|
This function initialize the HASH. Key shall be supplied if the underlaying algoritm is AES XCBC-MAC or CMAC. Key shall be NULL if the underlaying algoritm is SHA.
For XCBC-MAC, the key length must be 16. For CMAC, the key length can be the AES key lengths supported by AES engine. For MDHA the key length argument is ignored.
- Parameters
-
| base | LTC peripheral base address |
[out] | ctx | Output hash context |
| algo | Underlaying algorithm to use for hash computation. |
| key | Input key (NULL if underlaying algorithm is SHA) |
| keySize | Size of input key in bytes |
- Returns
- Status of initialization
status_t LTC_HASH_Update |
( |
ltc_hash_ctx_t * |
ctx, |
|
|
const uint8_t * |
input, |
|
|
uint32_t |
inputSize |
|
) |
| |
Add data to current HASH. This can be called repeatedly with an arbitrary amount of data to be hashed.
- Parameters
-
[in,out] | ctx | HASH context |
| input | Input data |
| inputSize | Size of input data in bytes |
- Returns
- Status of the hash update operation
status_t LTC_HASH_Finish |
( |
ltc_hash_ctx_t * |
ctx, |
|
|
uint8_t * |
output, |
|
|
uint32_t * |
outputSize |
|
) |
| |
Outputs the final hash and erases the context.
- Parameters
-
[in,out] | ctx | Input hash context |
[out] | output | Output hash data |
[out] | outputSize | Output parameter storing the size of the output hash in bytes |
- Returns
- Status of the hash finish operation
status_t LTC_HASH |
( |
LTC_Type * |
base, |
|
|
ltc_hash_algo_t |
algo, |
|
|
const uint8_t * |
input, |
|
|
uint32_t |
inputSize, |
|
|
const uint8_t * |
key, |
|
|
uint32_t |
keySize, |
|
|
uint8_t * |
output, |
|
|
uint32_t * |
outputSize |
|
) |
| |
Perform the full keyed HASH in one function call.
- Parameters
-
| base | LTC peripheral base address |
| algo | Block cipher algorithm to use for CMAC creation |
| input | Input data |
| inputSize | Size of input data in bytes |
| key | Input key |
| keySize | Size of input key in bytes |
[out] | output | Output hash data |
[out] | outputSize | Output parameter storing the size of the output hash in bytes |
- Returns
- Status of the one call hash operation.