MCUX CLNS MCUX Crypto Library Normal Secure |

Functions
mcuxClHash_Functions
mcuxClHash

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

  session | Session to be used with the hash function.
  algo | Algorithm to be used with the hash function.
  in | Pointer to the input message
  inSize | Length of the input message
  hash | Computed hash value over the input message
  rtf | Updated 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_OK | Hash operation successful
  MCUXCLHASH_STATUS_ERROR | Error 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

  session | Session to be used with the hash function.
  context | The context to initialize.
  algo | The 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_OK | Hash operation successful
  MCUXCLHASH_STATUS_ERROR | Error 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

  session | Session to be used with the hash function.
  context | The hash context.
  in | Pointer to the data to be added to the hash.
  inSize | Size of the data to be added to the hash.

Returns
  A code-flow protected error code (see Flow Protection API)

Return values

  MCUXCLHASH_STATUS_OK | Hash operation successful
  MCUXCLHASH_STATUS_ERROR | Error 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

  session | Session to be used with the hash function.
  context | The hash context.
  hash | Pointer to the location where the function should write the resulting hash.
  rtf | Pointer 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_OK | Hash operation successful
  MCUXCLHASH_STATUS_ERROR | Error occured during Hash operation