MCUXpresso SDK API Reference Manual  Rev. 0
NXP Semiconductors
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
Hashcrypt_driver_hash

Overview

Data Structures

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

Macros

#define HASHCRYPT_HASH_CTX_SIZE   22
 HASHCRYPT HASH Context size. More...
 

Typedefs

typedef void(* hashcrypt_callback_t )(HASHCRYPT_Type *base, hashcrypt_hash_ctx_t *ctx, status_t status, void *userData)
 HASHCRYPT background hash callback function. More...
 

Functions

status_t HASHCRYPT_SHA (HASHCRYPT_Type *base, hashcrypt_algo_t algo, const uint8_t *input, size_t inputSize, uint8_t *output, size_t *outputSize)
 Create HASH on given data. More...
 
status_t HASHCRYPT_SHA_Init (HASHCRYPT_Type *base, hashcrypt_hash_ctx_t *ctx, hashcrypt_algo_t algo)
 Initialize HASH context. More...
 
status_t HASHCRYPT_SHA_Update (HASHCRYPT_Type *base, hashcrypt_hash_ctx_t *ctx, const uint8_t *input, size_t inputSize)
 Add data to current HASH. More...
 
status_t HASHCRYPT_SHA_Finish (HASHCRYPT_Type *base, hashcrypt_hash_ctx_t *ctx, uint8_t *output, size_t *outputSize)
 Finalize hashing. More...
 

Data Structure Documentation

struct hashcrypt_hash_ctx_t

Data Fields

uint32_t x [HASHCRYPT_HASH_CTX_SIZE]
 storage
 

Macro Definition Documentation

#define HASHCRYPT_HASH_CTX_SIZE   22

Typedef Documentation

typedef void(* hashcrypt_callback_t)(HASHCRYPT_Type *base, hashcrypt_hash_ctx_t *ctx, status_t status, void *userData)

Function Documentation

status_t HASHCRYPT_SHA ( HASHCRYPT_Type *  base,
hashcrypt_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
baseHASHCRYPT 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.
status_t HASHCRYPT_SHA_Init ( HASHCRYPT_Type *  base,
hashcrypt_hash_ctx_t ctx,
hashcrypt_algo_t  algo 
)

This function initializes the HASH.

Parameters
baseHASHCRYPT peripheral base address
[out]ctxOutput hash context
algoUnderlaying algorithm to use for hash computation.
Returns
Status of initialization
status_t HASHCRYPT_SHA_Update ( HASHCRYPT_Type *  base,
hashcrypt_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 has been updated (HASHCRYPT has processed the input data), so the memory at input pointer can be released back to system. The HASHCRYPT context buffer is updated with the running hash and with all necessary information to support possible context switch.

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

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

Parameters
baseHASHCRYPT peripheral base address
[in,out]ctxInput hash context
[out]outputOutput hash data
[in,out]outputSizeOptional parameter (can be passed as NULL). On function entry, it specifies the size of output[] buffer. On function return, it stores the number of updated output bytes.
Returns
Status of the hash finish operation