Modules | Classes | Macros | Functions

HASH driver modules. More...

Collaboration diagram for HASH:

Modules

 HASH_Exported_Constants
 
 HASH_Private_Functions
 

Classes

struct  HASH_Context
 HASH context swapping structure definition. More...
 
struct  HASH_InitTypeDef
 HASH Init structure definition. More...
 
struct  HASH_MsgDigest
 HASH message digest result structure definition. More...
 

Macros

#define MD5BUSY_TIMEOUT   ((uint32_t) 0x00010000)
 
#define SHA1BUSY_TIMEOUT   ((uint32_t) 0x00010000)
 

Functions

void HASH_AutoStartDigest (FunctionalState NewState)
 Enables or disables auto-start message padding and calculation of the final message digest at the end of DMA transfer. More...
 
void HASH_ClearFlag (uint32_t HASH_FLAG)
 Clears the HASH flags. More...
 
void HASH_ClearITPendingBit (uint32_t HASH_IT)
 Clears the HASH interrupt pending bit(s). More...
 
void HASH_DataIn (uint32_t Data)
 Writes data in the Data Input FIFO. More...
 
void HASH_DeInit (void)
 De-initializes the HASH peripheral registers to their default reset values. More...
 
void HASH_DMACmd (FunctionalState NewState)
 Enables or disables the HASH DMA interface. More...
 
void HASH_GetDigest (HASH_MsgDigest *HASH_MessageDigest)
 Provides the message digest result. More...
 
FlagStatus HASH_GetFlagStatus (uint32_t HASH_FLAG)
 Checks whether the specified HASH flag is set or not. More...
 
uint8_t HASH_GetInFIFOWordsNbr (void)
 Returns the number of words already pushed into the IN FIFO. More...
 
ITStatus HASH_GetITStatus (uint32_t HASH_IT)
 Checks whether the specified HASH interrupt has occurred or not. More...
 
void HASH_Init (HASH_InitTypeDef *HASH_InitStruct)
 Initializes the HASH peripheral according to the specified parameters in the HASH_InitStruct structure. More...
 
void HASH_ITConfig (uint32_t HASH_IT, FunctionalState NewState)
 Enables or disables the specified HASH interrupts. More...
 
ErrorStatus HASH_MD5 (uint8_t *Input, uint32_t Ilen, uint8_t Output[16])
 Compute the HASH MD5 digest. More...
 
void HASH_Reset (void)
 Resets the HASH processor core, so that the HASH will be ready to compute the message digest of a new message. More...
 
void HASH_RestoreContext (HASH_Context *HASH_ContextRestore)
 Restore the Hash peripheral Context. More...
 
void HASH_SaveContext (HASH_Context *HASH_ContextSave)
 Save the Hash peripheral Context. More...
 
void HASH_SetLastWordValidBitsNbr (uint16_t ValidNumber)
 Configure the Number of valid bits in last word of the message. More...
 
ErrorStatus HASH_SHA1 (uint8_t *Input, uint32_t Ilen, uint8_t Output[20])
 Compute the HASH SHA1 digest. More...
 
void HASH_StartDigest (void)
 Starts the message padding and calculation of the final message. More...
 
void HASH_StructInit (HASH_InitTypeDef *HASH_InitStruct)
 Fills each HASH_InitStruct member with its default value. More...
 
ErrorStatus HMAC_MD5 (uint8_t *Key, uint32_t Keylen, uint8_t *Input, uint32_t Ilen, uint8_t Output[16])
 Compute the HMAC MD5 digest. More...
 
ErrorStatus HMAC_SHA1 (uint8_t *Key, uint32_t Keylen, uint8_t *Input, uint32_t Ilen, uint8_t Output[20])
 Compute the HMAC SHA1 digest. More...
 

Detailed Description

HASH driver modules.

Macro Definition Documentation

#define MD5BUSY_TIMEOUT   ((uint32_t) 0x00010000)

Definition at line 60 of file stm32f4xx_hash_md5.c.

#define SHA1BUSY_TIMEOUT   ((uint32_t) 0x00010000)

Definition at line 60 of file stm32f4xx_hash_sha1.c.

Function Documentation

void HASH_AutoStartDigest ( FunctionalState  NewState)

Enables or disables auto-start message padding and calculation of the final message digest at the end of DMA transfer.

Parameters
NewStatenew state of the selected HASH DMA transfer request. This parameter can be: ENABLE or DISABLE.
Return values
None

Definition at line 465 of file stm32f4xx_hash.c.

void HASH_ClearFlag ( uint32_t  HASH_FLAG)

Clears the HASH flags.

Parameters
HASH_FLAGspecifies the flag to clear. This parameter can be any combination of the following values:
  • HASH_FLAG_DINIS: Data Input Flag
  • HASH_FLAG_DCIS: Digest Calculation Completion Flag
Return values
None

Definition at line 651 of file stm32f4xx_hash.c.

void HASH_ClearITPendingBit ( uint32_t  HASH_IT)

Clears the HASH interrupt pending bit(s).

Parameters
HASH_ITspecifies the HASH interrupt pending bit(s) to clear. This parameter can be any combination of the following values:
  • HASH_IT_DINI: Data Input interrupt
  • HASH_IT_DCI: Digest Calculation Completion Interrupt
Return values
None

Definition at line 701 of file stm32f4xx_hash.c.

void HASH_DataIn ( uint32_t  Data)

Writes data in the Data Input FIFO.

Parameters
Datanew data of the message to be processed.
Return values
None

Definition at line 306 of file stm32f4xx_hash.c.

void HASH_DeInit ( void  )

De-initializes the HASH peripheral registers to their default reset values.

Parameters
None
Return values
None

Definition at line 171 of file stm32f4xx_hash.c.

void HASH_DMACmd ( FunctionalState  NewState)

Enables or disables the HASH DMA interface.

Note
The DMA is disabled by hardware after the end of transfer.
Parameters
NewStatenew state of the selected HASH DMA transfer request. This parameter can be: ENABLE or DISABLE.
Return values
None

Definition at line 489 of file stm32f4xx_hash.c.

void HASH_GetDigest ( HASH_MsgDigest HASH_MessageDigest)

Provides the message digest result.

Note
In MD5 mode, Data[7] to Data[4] filed of HASH_MsgDigest structure is not used and is read as zero. In SHA-1 mode, Data[7] to Data[5] filed of HASH_MsgDigest structure is not used and is read as zero. In SHA-224 mode, Data[7] filed of HASH_MsgDigest structure is not used and is read as zero.
Parameters
HASH_MessageDigestpointer to a HASH_MsgDigest structure which will hold the message digest result
Return values
None

Definition at line 335 of file stm32f4xx_hash.c.

FlagStatus HASH_GetFlagStatus ( uint32_t  HASH_FLAG)

Checks whether the specified HASH flag is set or not.

Parameters
HASH_FLAGspecifies the HASH flag to check. This parameter can be one of the following values:
  • HASH_FLAG_DINIS: Data input interrupt status flag
  • HASH_FLAG_DCIS: Digest calculation completion interrupt status flag
  • HASH_FLAG_BUSY: Busy flag
  • HASH_FLAG_DMAS: DMAS Status flag
  • HASH_FLAG_DINNE: Data Input register (DIN) not empty status flag
Return values
Thenew state of HASH_FLAG (SET or RESET)

Definition at line 610 of file stm32f4xx_hash.c.

uint8_t HASH_GetInFIFOWordsNbr ( void  )

Returns the number of words already pushed into the IN FIFO.

Parameters
None
Return values
Thevalue of words already pushed into the IN FIFO.

Definition at line 317 of file stm32f4xx_hash.c.

ITStatus HASH_GetITStatus ( uint32_t  HASH_IT)

Checks whether the specified HASH interrupt has occurred or not.

Parameters
HASH_ITspecifies the HASH interrupt source to check. This parameter can be one of the following values:
  • HASH_IT_DINI: Data Input interrupt
  • HASH_IT_DCI: Digest Calculation Completion Interrupt
Return values
Thenew state of HASH_IT (SET or RESET).

Definition at line 667 of file stm32f4xx_hash.c.

void HASH_Init ( HASH_InitTypeDef HASH_InitStruct)

Initializes the HASH peripheral according to the specified parameters in the HASH_InitStruct structure.

Note
the hash processor is reset when calling this function so that the HASH will be ready to compute the message digest of a new message. There is no need to call HASH_Reset() function.
Parameters
HASH_InitStructpointer to a HASH_InitTypeDef structure that contains the configuration information for the HASH peripheral.
Note
The field HASH_HMACKeyType in HASH_InitTypeDef must be filled only if the algorithm mode is HMAC.
Return values
None

Definition at line 191 of file stm32f4xx_hash.c.

void HASH_ITConfig ( uint32_t  HASH_IT,
FunctionalState  NewState 
)

Enables or disables the specified HASH interrupts.

Parameters
HASH_ITspecifies the HASH interrupt source to be enabled or disabled. This parameter can be any combination of the following values:
  • HASH_IT_DINI: Data Input interrupt
  • HASH_IT_DCI: Digest Calculation Completion Interrupt
NewStatenew state of the specified HASH interrupt. This parameter can be: ENABLE or DISABLE.
Return values
None

Definition at line 581 of file stm32f4xx_hash.c.

ErrorStatus HASH_MD5 ( uint8_t *  Input,
uint32_t  Ilen,
uint8_t  Output[16] 
)

Compute the HASH MD5 digest.

Parameters
Inputpointer to the Input buffer to be treated.
Ilenlength of the Input buffer.
Outputthe returned digest
Return values
AnErrorStatus enumeration value:
  • SUCCESS: digest computation done
  • ERROR: digest computation failed

Definition at line 93 of file stm32f4xx_hash_md5.c.

void HASH_Reset ( void  )

Resets the HASH processor core, so that the HASH will be ready to compute the message digest of a new message.

Note
Calling this function will clear the HASH_SR_DCIS (Digest calculation completion interrupt status) bit corresponding to HASH_IT_DCI interrupt and HASH_FLAG_DCIS flag.
Parameters
None
Return values
None

Definition at line 249 of file stm32f4xx_hash.c.

void HASH_RestoreContext ( HASH_Context HASH_ContextRestore)

Restore the Hash peripheral Context.

Note
After calling this function, user can restart the processing from the point where it has been interrupted.
Parameters
HASH_ContextRestorepointer to a HASH_Context structure that contains the repository for saved context.
Return values
None

Definition at line 418 of file stm32f4xx_hash.c.

void HASH_SaveContext ( HASH_Context HASH_ContextSave)

Save the Hash peripheral Context.

Note
The context can be saved only when no block is currently being processed. So user must wait for DINIS = 1 (the last block has been processed and the input FIFO is empty) or NBW != 0 (the FIFO is not full and no processing is ongoing).
Parameters
HASH_ContextSavepointer to a HASH_Context structure that contains the repository for current context.
Return values
None

Definition at line 396 of file stm32f4xx_hash.c.

void HASH_SetLastWordValidBitsNbr ( uint16_t  ValidNumber)

Configure the Number of valid bits in last word of the message.

Parameters
ValidNumberNumber of valid bits in last word of the message. This parameter must be a number between 0 and 0x1F.
  • 0x00: All 32 bits of the last data written are valid
  • 0x01: Only bit [0] of the last data written is valid
  • 0x02: Only bits[1:0] of the last data written are valid
  • 0x03: Only bits[2:0] of the last data written are valid
  • ...
  • 0x1F: Only bits[30:0] of the last data written are valid
Note
The Number of valid bits must be set before to start the message digest competition (in Hash and HMAC) and key treatment(in HMAC).
Return values
None

Definition at line 291 of file stm32f4xx_hash.c.

ErrorStatus HASH_SHA1 ( uint8_t *  Input,
uint32_t  Ilen,
uint8_t  Output[20] 
)

Compute the HASH SHA1 digest.

Parameters
Inputpointer to the Input buffer to be treated.
Ilenlength of the Input buffer.
Outputthe returned digest
Return values
AnErrorStatus enumeration value:
  • SUCCESS: digest computation done
  • ERROR: digest computation failed

Definition at line 93 of file stm32f4xx_hash_sha1.c.

void HASH_StartDigest ( void  )

Starts the message padding and calculation of the final message.

Parameters
None
Return values
None

Definition at line 353 of file stm32f4xx_hash.c.

void HASH_StructInit ( HASH_InitTypeDef HASH_InitStruct)

Fills each HASH_InitStruct member with its default value.

Parameters
HASH_InitStruct: pointer to a HASH_InitTypeDef structure which will be initialized.
Note
The default values set are : Processor mode is HASH, Algorithm selected is SHA1, Data type selected is 32b and HMAC Key Type is short key.
Return values
None

Definition at line 225 of file stm32f4xx_hash.c.

ErrorStatus HMAC_MD5 ( uint8_t *  Key,
uint32_t  Keylen,
uint8_t *  Input,
uint32_t  Ilen,
uint8_t  Output[16] 
)

Compute the HMAC MD5 digest.

Parameters
Keypointer to the Key used for HMAC.
Keylenlength of the Key used for HMAC.
Inputpointer to the Input buffer to be treated.
Ilenlength of the Input buffer.
Outputthe returned digest
Return values
AnErrorStatus enumeration value:
  • SUCCESS: digest computation done
  • ERROR: digest computation failed

Definition at line 168 of file stm32f4xx_hash_md5.c.

ErrorStatus HMAC_SHA1 ( uint8_t *  Key,
uint32_t  Keylen,
uint8_t *  Input,
uint32_t  Ilen,
uint8_t  Output[20] 
)

Compute the HMAC SHA1 digest.

Parameters
Keypointer to the Key used for HMAC.
Keylenlength of the Key used for HMAC.
Inputpointer to the Input buffer to be treated.
Ilenlength of the Input buffer.
Outputthe returned digest
Return values
AnErrorStatus enumeration value:
  • SUCCESS: digest computation done
  • ERROR: digest computation failed

Definition at line 169 of file stm32f4xx_hash_sha1.c.



rosflight_firmware
Author(s): Daniel Koch , James Jackson
autogenerated on Wed Jul 3 2019 19:59:29