InPlay API
Cryptographic Hash Profile

HAL HASH. More...

Enumerations

enum  hash_type { HASH_TYPE_MD5 = 0, HASH_TYPE_SHA1 = 1, HASH_TYPE_SHA256 = 2 }
 HASH function type. More...
 
enum  HASH_result_status {
  HASH_ERR_OK = 0, HASH_ERR_NOT_INIT = -1, HASH_ERR_ALREADY_INIT = -2, HASH_ERR_DEV_BAD_STATE = -3,
  HASH_ERR_INVALID_PARA = -4
}
 HASH function status return. More...
 

Functions

int hal_hash_open (hash_init_t *init)
 Initialize hash driver for power management and interrupt purposes. More...
 
int hal_hash_close (void)
 De-Initialize hash driver for power management and interrupt purposes. More...
 
int hal_hash_start (hash_type type)
 Set-up and initialize hash functionality. More...
 
int hal_hash_process (uint8_t *data, uint32_t data_len)
 Process hash based on input payload. More...
 
int hal_hash_finish (uint8_t *out, uint16_t len)
 Write hash result to output buffer. More...
 

Detailed Description

HAL HASH.

Enumeration Type Documentation

◆ HASH_result_status

HASH function status return.

Enumerator
HASH_ERR_OK 

No errors, good status.

HASH_ERR_NOT_INIT 

Error, HASH driver not initialized.

HASH_ERR_ALREADY_INIT 

Error, HASH driver already initialized.

HASH_ERR_DEV_BAD_STATE 

Error, HASH bad state.

HASH_ERR_INVALID_PARA 

Error, invalid HASH parameter.

◆ hash_type

enum hash_type

HASH function type.

Enumerator
HASH_TYPE_MD5 

HASH type MD-5.

HASH_TYPE_SHA1 

HASH type SHA-1.

HASH_TYPE_SHA256 

HASH type SHA-256.

Function Documentation

◆ hal_hash_close()

int hal_hash_close ( void  )

De-Initialize hash driver for power management and interrupt purposes.

Returns
HASH_ERR_OK if HASH uninitializes successfully, error otherwise.
See also
enum HASH_result_status.

◆ hal_hash_finish()

int hal_hash_finish ( uint8_t *  out,
uint16_t  len 
)

Write hash result to output buffer.

Parameters
[out]outPointer to output of HASH result
[in]lenOutput buffer length
Returns
HASH_ERR_OK if successful, error otherwise.
See also
enum HASH_result_status

◆ hal_hash_open()

int hal_hash_open ( hash_init_t *  init)

Initialize hash driver for power management and interrupt purposes.

Parameters
[in]initInit parameters for hash driver, hash_init_t
Returns
HASH_ERR_OK if HASH initializes successfully, error otherwise.
See also
enum HASH_result_status.

◆ hal_hash_process()

int hal_hash_process ( uint8_t *  data,
uint32_t  data_len 
)

Process hash based on input payload.

Parameters
[in]dataPointer to data to be hashed
[in]data_lenLength of data to be hashed in bytes
Returns
HASH_ERR_OK if successful, error otherwise.
See also
enum HASH_result_status

◆ hal_hash_start()

int hal_hash_start ( hash_type  type)

Set-up and initialize hash functionality.

Parameters
[in]typeHash functionality type,
See also
enum hash_type
Returns
HASH_ERR_OK if successful, error otherwise.
See also
enum HASH_result_status