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

Overview

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

Data Structures

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

Macros

#define CAU3_SHA_BLOCK_SIZE   128U
 CAU3 HASH Context size. More...
 
#define CAU3_HASH_BLOCK_SIZE   CAU3_SHA_BLOCK_SIZE
 CAU3 hash block size.
 
#define CAU3_HASH_CTX_SIZE   58
 CAU3 HASH Context size. More...
 

Typedefs

typedef enum _cau3_hash_algo_t cau3_hash_algo_t
 Supported cryptographic block cipher functions for HASH creation.
 
typedef struct _cau3_hash_ctx_t cau3_hash_ctx_t
 Storage type used to save hash context. More...
 

Enumerations

enum  _cau3_hash_algo_t {
  kCAU3_Sha1,
  kCAU3_Sha256
}
 Supported cryptographic block cipher functions for HASH creation. More...
 

Functions

status_t CAU3_HASH_Init (CAU3_Type *base, cau3_hash_ctx_t *ctx, cau3_hash_algo_t algo)
 Initialize HASH context. More...
 
status_t CAU3_HASH_Update (CAU3_Type *base, cau3_hash_ctx_t *ctx, const uint8_t *input, size_t inputSize)
 Add data to current HASH. More...
 
status_t CAU3_HASH_Finish (CAU3_Type *base, cau3_hash_ctx_t *ctx, uint8_t *output, size_t *outputSize)
 Finalize hashing. More...
 
status_t CAU3_HASH (CAU3_Type *base, cau3_hash_algo_t algo, const uint8_t *input, size_t inputSize, uint8_t *output, size_t *outputSize)
 Create HASH on given data. More...
 

Data Structure Documentation

struct _cau3_hash_ctx_t

Macro Definition Documentation

#define CAU3_SHA_BLOCK_SIZE   128U

internal buffer block size

#define CAU3_HASH_CTX_SIZE   58

Typedef Documentation

Enumeration Type Documentation

Enumerator
kCAU3_Sha1 

SHA_1.

kCAU3_Sha256 

SHA_256.

Function Documentation

status_t CAU3_HASH_Init ( CAU3_Type *  base,
cau3_hash_ctx_t ctx,
cau3_hash_algo_t  algo 
)

This function initializes the HASH.

For blocking CAU3 HASH API, the HASH context contains all information required for context switch, such as running hash.

Parameters
baseCAU3 peripheral base address
[out]ctxOutput hash context
algoUnderlaying algorithm to use for hash computation.
Returns
Status of initialization
status_t CAU3_HASH_Update ( CAU3_Type *  base,
cau3_hash_ctx_t ctx,
const uint8_t *  input,
size_t  inputSize 
)

Add data to current HASH. This can be called repeatedly with an arbitrary amount of data to be hashed. The functions blocks. If it returns kStatus_Success, the running hash or mac has been updated (CAU3 has processed the input data), so the memory at input pointer can be released back to system. The context is updated with the running hash or mac and with all necessary information to support possible context switch.

Parameters
baseCAU3 peripheral base address
[in,out]ctxHASH context
inputInput data
inputSizeSize of input data in bytes
Returns
Status of the hash update operation
status_t CAU3_HASH_Finish ( CAU3_Type *  base,
cau3_hash_ctx_t ctx,
uint8_t *  output,
size_t *  outputSize 
)

Outputs the final hash (computed by CAU3_HASH_Update()) and erases the context.

Parameters
baseCAU3 peripheral base address
[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 CAU3_HASH ( CAU3_Type *  base,
cau3_hash_algo_t  algo,
const uint8_t *  input,
size_t  inputSize,
uint8_t *  output,
size_t *  outputSize 
)

Perform the full SHA in one function call. The function is blocking.

Parameters
baseCAU3 peripheral base address
algoUnderlaying algorithm to use for hash computation.
inputInput data
inputSizeSize of input data 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.