MCUXpresso SDK API Reference Manual  Rev. 0
NXP Semiconductors
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
CAAM Non-blocking HASH driver

Overview

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...
 

Function Documentation

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.

Parameters
[in,out]ctxHASH context
inputInput data
inputSizeSize of input data in bytes
Returns
Status of the hash update operation
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.

Parameters
[in,out]ctxInput hash context
[out]descriptorMemory for the CAAM descriptor.
[out]outputOutput hash data
[out]outputSizeOutput parameter storing the size of the output hash in bytes
Returns
Status of the hash finish operation
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.

Parameters
baseCAAM peripheral base address
handleHandle used for this request.
[out]descriptorMemory for the CAAM descriptor.
algoUnderlaying algorithm to use for hash computation.
inputInput data
inputSizeSize of input data in bytes
keyInput key (NULL if underlaying algorithm is SHA)
keySizeSize of input key in bytes
[out]outputOutput hash data
[out]outputSizeOutput parameter storing the size of the output hash in bytes
Returns
Status of the one call hash operation.