| Kinetis SDK v.2.0 API Reference Manual Rev. 0 Freescale Semiconductor, Inc.

- Main Page
- Related Pages
- API Reference

All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
Macros | Typedefs | Enumerations | Functions
LTC HASH driver
LTC Blocking APIs

## Overview

This section describes the programming interface of the LTC HASH driver.

## Macros
#define | LTC_HASH_CTX_SIZE 29
| LTC HASH Context size. More...

## Typedefs
typedef uint32_t | ltc_hash_ctx_t [LTC_HASH_CTX_SIZE]
| Storage type used to save hash context. More...

## Enumerations
enum | ltc_hash_algo_t { kLTC_XcbcMac = 0, kLTC_Cmac }
| Supported cryptographic block cipher functions for HASH creation. More...

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

## Macro Definition Documentation

#define LTC_HASH_CTX_SIZE 29

## Typedef Documentation

typedef uint32_t ltc_hash_ctx_t[LTC_HASH_CTX_SIZE]

## Enumeration Type Documentation

enum ltc_hash_algo_t

Enumerator
kLTC_XcbcMac | XCBC-MAC (AES engine)
kLTC_Cmac | CMAC (AES engine)

## Function Documentation

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

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.