MCUXpresso SDK API Reference Manual  Rev 2.12.1
NXP Semiconductors
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
LTC HASH driver

Overview

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

Data Structures

struct  ltc_hash_ctx_t
 Storage type used to save hash context. More...
 

Macros

#define LTC_HASH_CTX_SIZE   29
 LTC HASH Context size. 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...
 

Data Structure Documentation

struct ltc_hash_ctx_t

Macro Definition Documentation

#define LTC_HASH_CTX_SIZE   29

Enumeration Type Documentation

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
baseLTC peripheral base address
[out]ctxOutput hash context
algoUnderlaying algorithm to use for hash computation.
keyInput key (NULL if underlaying algorithm is SHA)
keySizeSize 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]ctxHASH context
inputInput data
inputSizeSize 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]ctxInput hash context
[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 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
baseLTC peripheral base address
algoBlock cipher algorithm to use for CMAC creation
inputInput data
inputSizeSize of input data in bytes
keyInput key
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.