RTEMS 6.1-rc4
Loading...
Searching...
No Matches
Data Structures | Macros | Typedefs | Enumerations | Functions
Dcp_driver_hash

Data Structures

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

Macros

#define DCP_HASH_CAVP_COMPATIBLE
 
#define DCP_SHA_BLOCK_SIZE   128U
 DCP HASH Context size.
 
#define DCP_HASH_BLOCK_SIZE   DCP_SHA_BLOCK_SIZE
 
#define DCP_HASH_CTX_SIZE   64
 DCP HASH Context size.
 

Typedefs

typedef enum _dcp_hash_algo_t dcp_hash_algo_t
 Supported cryptographic block cipher functions for HASH creation.
 
typedef struct _dcp_hash_ctx_t dcp_hash_ctx_t
 Storage type used to save hash context.
 

Enumerations

enum  _dcp_hash_algo_t { kDCP_Sha1 , kDCP_Sha256 , kDCP_Crc32 }
 Supported cryptographic block cipher functions for HASH creation. More...
 

Functions

status_t DCP_HASH_Init (DCP_Type *base, dcp_handle_t *handle, dcp_hash_ctx_t *ctx, dcp_hash_algo_t algo)
 Initialize HASH context.
 
status_t DCP_HASH_Update (DCP_Type *base, dcp_hash_ctx_t *ctx, const uint8_t *input, size_t inputSize)
 Add data to current HASH.
 
status_t DCP_HASH_Finish (DCP_Type *base, dcp_hash_ctx_t *ctx, uint8_t *output, size_t *outputSize)
 Finalize hashing.
 
status_t DCP_HASH (DCP_Type *base, dcp_handle_t *handle, dcp_hash_algo_t algo, const uint8_t *input, size_t inputSize, uint8_t *output, size_t *outputSize)
 Create HASH on given data.
 

Detailed Description

Macro Definition Documentation

◆ DCP_HASH_BLOCK_SIZE

#define DCP_HASH_BLOCK_SIZE   DCP_SHA_BLOCK_SIZE

DCP hash block size

◆ DCP_SHA_BLOCK_SIZE

#define DCP_SHA_BLOCK_SIZE   128U

DCP HASH Context size.

internal buffer block size

Enumeration Type Documentation

◆ _dcp_hash_algo_t

Supported cryptographic block cipher functions for HASH creation.

Enumerator
kDCP_Sha1 

SHA_1

kDCP_Sha256 

SHA_256

kDCP_Crc32 

CRC_32

Function Documentation

◆ DCP_HASH()

status_t DCP_HASH ( DCP_Type base,
dcp_handle_t handle,
dcp_hash_algo_t  algo,
const uint8_t *  input,
size_t  inputSize,
uint8_t *  output,
size_t *  outputSize 
)

Create HASH on given data.

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

Parameters
baseDCP peripheral base address
handleHandle used for the request.
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.

brief Create HASH on given data

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

param base DCP peripheral base address param handle Handle used for the request. param algo Underlaying algorithm to use for hash computation. param input Input data param inputSize Size of input data in bytes param[out] output Output hash data param[out] outputSize Output parameter storing the size of the output hash in bytes return Status of the one call hash operation.

◆ DCP_HASH_Finish()

status_t DCP_HASH_Finish ( DCP_Type base,
dcp_hash_ctx_t ctx,
uint8_t *  output,
size_t *  outputSize 
)

Finalize hashing.

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

Parameters
baseDCP 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

brief Finalize hashing

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

param[in,out] ctx Input hash context param[out] output Output hash data param[in,out] outputSize Optional 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. return Status of the hash finish operation

◆ DCP_HASH_Init()

status_t DCP_HASH_Init ( DCP_Type base,
dcp_handle_t handle,
dcp_hash_ctx_t ctx,
dcp_hash_algo_t  algo 
)

Initialize HASH context.

This function initializes the HASH.

Parameters
baseDCP peripheral base address
handleSpecifies the DCP channel used for hashing.
[out]ctxOutput hash context
algoUnderlaying algorithm to use for hash computation.
Returns
Status of initialization

brief Initialize HASH context

This function initializes the HASH.

param base DCP peripheral base address param handle Specifies the DCP channel used for hashing. param[out] ctx Output hash context param algo Underlaying algorithm to use for hash computation. return Status of initialization

◆ DCP_HASH_Update()

status_t DCP_HASH_Update ( DCP_Type base,
dcp_hash_ctx_t ctx,
const uint8_t *  input,
size_t  inputSize 
)

Add data to current HASH.

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 (DCP has processed the input data), so the memory at the input pointer can be released back to system. The DCP context buffer is updated with the running hash and with all necessary information to support possible context switch.

Parameters
baseDCP peripheral base address
[in,out]ctxHASH context
inputInput data
inputSizeSize of input data in bytes
Returns
Status of the hash update operation

brief Add data to current HASH

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 (DCP has processed the input data), so the memory at ref input pointer can be released back to system. The DCP context buffer is updated with the running hash and with all necessary information to support possible context switch.

param base DCP peripheral base address param[in,out] ctx HASH context param input Input data param inputSize Size of input data in bytes return Status of the hash update operation