libopencm3
A free/libre/open-source firmware library for various ARM Cortex-M3 microcontrollers.
HASH Peripheral API
Collaboration diagram for HASH Peripheral API:

Functions

void hash_set_mode (uint8_t mode)
 HASH Set Mode. More...
 
void hash_set_algorithm (uint8_t algorithm)
 HASH Set Algorithm. More...
 
void hash_set_data_type (uint8_t datatype)
 HASH Set Data Type. More...
 
void hash_set_key_length (uint8_t keylength)
 HASH Set Key Length. More...
 
void hash_set_last_word_valid_bits (uint8_t validbits)
 HASH Set Last Word Valid Bits. More...
 
void hash_init ()
 HASH Init. More...
 
void hash_add_data (uint32_t data)
 HASH Add data. More...
 
void hash_digest ()
 HASH Digest. More...
 
void hash_get_result (uint32_t *data)
 HASH Get Hash Result. More...
 

Detailed Description

Author
© 2013 Mikhail Avkhimenia mikha.nosp@m.il@a.nosp@m.vkhim.nosp@m.enia.nosp@m..net

This library supports the HASH processor in the STM32F2 and STM32F4 series of ARM Cortex Microcontrollers by ST Microelectronics.

LGPL License Terms libopencm3 License

Function Documentation

◆ hash_add_data()

void hash_add_data ( uint32_t  data)

HASH Add data.

Puts data into the HASH processor's queue.

Parameters
[in]dataunsigned int32. Hash input data.

Definition at line 127 of file hash_common_f24.c.

References HASH_DIN.

◆ hash_digest()

void hash_digest ( void  )

HASH Digest.

Starts the processing of the last data block.

Definition at line 139 of file hash_common_f24.c.

References HASH_STR, and HASH_STR_DCAL.

◆ hash_get_result()

void hash_get_result ( uint32_t *  data)

HASH Get Hash Result.

Makes a copy of the resulting hash.

Parameters
[out]dataunsigned int32. Hash 4\5 words long depending on the algorithm.

Definition at line 152 of file hash_common_f24.c.

References HASH_ALGO_SHA1, HASH_CR, HASH_CR_ALGO, and HASH_HR.

◆ hash_init()

void hash_init ( void  )

HASH Init.

Initializes the HASH processor.

Definition at line 114 of file hash_common_f24.c.

References HASH_CR, and HASH_CR_INIT.

◆ hash_set_algorithm()

void hash_set_algorithm ( uint8_t  algorithm)

HASH Set Algorithm.

Sets up the specified algorithm - either MD5 or SHA1.

Parameters
[in]algorithmunsigned int8. Hash algorithm: HASH Algorithm

Definition at line 59 of file hash_common_f24.c.

References HASH_CR, and HASH_CR_ALGO.

◆ hash_set_data_type()

void hash_set_data_type ( uint8_t  datatype)

HASH Set Data Type.

Sets up the specified data type: 32Bit, 16Bit, 8Bit, Bitstring.

Parameters
[in]datatypeunsigned int8. Hash data type: HASH Data Type

Definition at line 73 of file hash_common_f24.c.

References HASH_CR, and HASH_CR_DATATYPE.

◆ hash_set_key_length()

void hash_set_key_length ( uint8_t  keylength)

HASH Set Key Length.

Sets up the specified key length: Long, Short.

Parameters
[in]keylengthunsigned int8. Hash data type: HASH Key length

Definition at line 87 of file hash_common_f24.c.

References HASH_CR, and HASH_CR_LKEY.

◆ hash_set_last_word_valid_bits()

void hash_set_last_word_valid_bits ( uint8_t  validbits)

HASH Set Last Word Valid Bits.

Specifies the number of valid bits in the last word.

Parameters
[in]validbitsunsigned int8. Number of valid bits.

Definition at line 101 of file hash_common_f24.c.

References HASH_STR, and HASH_STR_NBW.

◆ hash_set_mode()

void hash_set_mode ( uint8_t  mode)

HASH Set Mode.

Sets up the specified mode - either HASH or HMAC.

Parameters
[in]modeunsigned int8. Hash processor mode: HASH Mode

Definition at line 45 of file hash_common_f24.c.

References HASH_CR, and HASH_CR_MODE.