MCUX CLNS
MCUX Crypto Library Normal Secure
mcuxClHash_Functions

Defines all functions of mcuxClHash. More...

Functions

mcuxClHash_Status_Protected_t mcuxClHash_compute (mcuxClSession_Handle_t session, const mcuxClHash_Algo_t *algo, const uint8_t *const in, uint32_t inSize, uint8_t *const hash, uint8_t *const rtf)
 One-shot hash computation. More...
 
mcuxClHash_Status_Protected_t mcuxClHash_init (mcuxClSession_Handle_t session, mcuxClHash_Context_t *context, const mcuxClHash_Algo_t *algo)
 Initializes the context for a new hash computation. More...
 
mcuxClHash_Status_Protected_t mcuxClHash_update (mcuxClSession_Handle_t session, mcuxClHash_Context_t *context, const uint8_t *const in, uint32_t inSize)
 Adds a chunk of data to an ongoing hash computation. More...
 
mcuxClHash_Status_Protected_t mcuxClHash_finish (mcuxClSession_Handle_t session, mcuxClHash_Context_t *context, uint8_t *const hash, uint8_t *const rtf)
 Finishes a hash computation. More...
 

Detailed Description

Defines all functions of mcuxClHash.

Function Documentation

◆ mcuxClHash_compute()

mcuxClHash_Status_Protected_t mcuxClHash_compute ( mcuxClSession_Handle_t  session,
const mcuxClHash_Algo_t algo,
const uint8_t *const  in,
uint32_t  inSize,
uint8_t *const  hash,
uint8_t *const  rtf 
)

One-shot hash computation.

This function computes the hash over the input message in using the hash function provided by the algo input parameter.

The input parameter session has to be initialized by the function mcuxClSession_init prior to calling this function. Certain mcuxClHashAlgorithms support maintaining a Runtime Fingerprint (RTF). Updating of the RTF has to be enabled/disabled by calling the mcuxClSession_setRtf function on the session prior to calling this function.

Parameters
sessionSession to be used with the hash function.
algoAlgorithm to be used with the hash function.
inPointer to the input message
inSizeLength of the input message
hashComputed hash value over the input message
rtfUpdated RTF value after the hash operation. Only supported on platforms with CSS (Platform specific)
Returns
A code-flow protected error code (see Flow Protection API)
Return values
MCUXCLHASH_STATUS_OKHash operation successful
MCUXCLHASH_STATUS_ERRORError occured during Hash operation

◆ mcuxClHash_init()

mcuxClHash_Status_Protected_t mcuxClHash_init ( mcuxClSession_Handle_t  session,
mcuxClHash_Context_t context,
const mcuxClHash_Algo_t algo 
)

Initializes the context for a new hash computation.

The function initializes the context for the selected hash algorithm.

Up to 2^32 bytes of data can be hashed with a single context.

Parameters
sessionSession to be used with the hash function.
contextThe context to initialize.
algoThe selected hashing algorithm. This parameter must point to a statically allocated object (static or global variable).
Returns
A code-flow protected error code (see Flow Protection API)
Return values
MCUXCLHASH_STATUS_OKHash operation successful
MCUXCLHASH_STATUS_ERRORError occured during Hash operation

◆ mcuxClHash_update()

mcuxClHash_Status_Protected_t mcuxClHash_update ( mcuxClSession_Handle_t  session,
mcuxClHash_Context_t context,
const uint8_t *const  in,
uint32_t  inSize 
)

Adds a chunk of data to an ongoing hash computation.

This function appends the additional data to the context.

Up to 2^32 bytes of data can be hashed with a single context.

Parameters
sessionSession to be used with the hash function.
contextThe hash context.
inPointer to the data to be added to the hash.
inSizeSize of the data to be added to the hash.
Returns
A code-flow protected error code (see Flow Protection API)
Return values
MCUXCLHASH_STATUS_OKHash operation successful
MCUXCLHASH_STATUS_ERRORError occured during Hash operation

◆ mcuxClHash_finish()

mcuxClHash_Status_Protected_t mcuxClHash_finish ( mcuxClSession_Handle_t  session,
mcuxClHash_Context_t context,
uint8_t *const  hash,
uint8_t *const  rtf 
)

Finishes a hash computation.

This function processes the padding and outputs the resulting hash to the given buffer.

Parameters
sessionSession to be used with the hash function.
contextThe hash context.
hashPointer to the location where the function should write the resulting hash.
rtfPointer to the location where the function should write the run-time fingerprint (RTF). Only supported on platforms with CSSv2. If RTF updates are not enabled in the session, this pointer may be NULL.
Returns
A code-flow protected error code (see Flow Protection API)
Return values
MCUXCLHASH_STATUS_OKHash operation successful
MCUXCLHASH_STATUS_ERRORError occured during Hash operation