MCUXpresso SDK API Reference Manual
Rev. 0
NXP Semiconductors
|
This section describes the programming interface of the CAAM Non-blocking HASH driver.
Functions | |
status_t | CAAM_HASH_UpdateNonBlocking (caam_hash_ctx_t *ctx, const uint8_t *input, size_t inputSize) |
Add input address and size to input data table. More... | |
status_t | CAAM_HASH_FinishNonBlocking (caam_hash_ctx_t *ctx, caam_desc_hash_t descriptor, uint8_t *output, size_t *outputSize) |
Finalize hashing. More... | |
status_t | CAAM_HASH_NonBlocking (CAAM_Type *base, caam_handle_t *handle, caam_desc_hash_t descriptor, caam_hash_algo_t algo, const uint8_t *input, size_t inputSize, const uint8_t *key, size_t keySize, uint8_t *output, size_t *outputSize) |
Create HASH on given data. More... | |
status_t CAAM_HASH_UpdateNonBlocking | ( | caam_hash_ctx_t * | ctx, |
const uint8_t * | input, | ||
size_t | inputSize | ||
) |
Add data input pointer to a table maintained internally in the context. Each call of this function creates one entry in the table. The entry consists of the input pointer and inputSize. All entries created by one or multiple calls of this function can be processed in one call to CAAM_HASH_FinishNonBlocking() function. Individual entries can point to non-continuous data in the memory. The processing will occur in the order in which the CAAM_HASH_UpdateNonBlocking() have been called.
Memory pointers will be later accessed by CAAM (at time of CAAM_HASH_FinishNonBlocking()), so the memory must stay valid until CAAM_HASH_FinishNonBlocking() has been called and CAAM completes the processing.
[in,out] | ctx | HASH context |
input | Input data | |
inputSize | Size of input data in bytes |
status_t CAAM_HASH_FinishNonBlocking | ( | caam_hash_ctx_t * | ctx, |
caam_desc_hash_t | descriptor, | ||
uint8_t * | output, | ||
size_t * | outputSize | ||
) |
The actual algorithm is computed with all input data, the memory pointers are accessed by CAAM after the function returns. The input data chunks have been specified by prior calls to CAAM_HASH_UpdateNonBlocking(). The function schedules the request at CAAM, then returns. After a while, when the CAAM completes processing of the input data chunks, the result is written to the output[] array, outputSize is written and the context is cleared.
[in,out] | ctx | Input hash context |
[out] | descriptor | Memory for the CAAM descriptor. |
[out] | output | Output hash data |
[out] | outputSize | Output parameter storing the size of the output hash in bytes |
status_t CAAM_HASH_NonBlocking | ( | CAAM_Type * | base, |
caam_handle_t * | handle, | ||
caam_desc_hash_t | descriptor, | ||
caam_hash_algo_t | algo, | ||
const uint8_t * | input, | ||
size_t | inputSize, | ||
const uint8_t * | key, | ||
size_t | keySize, | ||
uint8_t * | output, | ||
size_t * | outputSize | ||
) |
Perform the full keyed XCBC-MAC/CMAC or SHA in one function call.
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.
The function is non-blocking. The request is scheduled at CAAM.
base | CAAM peripheral base address | |
handle | Handle used for this request. | |
[out] | descriptor | Memory for the CAAM descriptor. |
algo | Underlaying algorithm to use for hash computation. | |
input | Input data | |
inputSize | Size of input data in bytes | |
key | Input key (NULL if underlaying algorithm is SHA) | |
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 |