![]() |
STM32F769IDiscovery
1.00
uDANTE Audio Networking with STM32F7 DISCO board
|
HASH HAL module driver. This file provides firmware functions to manage the following functionalities of the HASH peripheral: More...
#include "stm32f7xx_hal.h"
Go to the source code of this file.
HASH HAL module driver. This file provides firmware functions to manage the following functionalities of the HASH peripheral:
============================================================================== ##### How to use this driver ##### ============================================================================== [..] The HASH HAL driver can be used as follows: (#)Initialize the HASH low level resources by implementing the HAL_HASH_MspInit(): (##) Enable the HASH interface clock using __HAL_RCC_HASH_CLK_ENABLE() (##) In case of using processing APIs based on interrupts (e.g. HAL_HMAC_SHA1_Start_IT()) (+++) Configure the HASH interrupt priority using HAL_NVIC_SetPriority() (+++) Enable the HASH IRQ handler using HAL_NVIC_EnableIRQ() (+++) In HASH IRQ handler, call HAL_HASH_IRQHandler() (##) In case of using DMA to control data transfer (e.g. HAL_HMAC_SHA1_Start_DMA()) (+++) Enable the DMAx interface clock using __DMAx_CLK_ENABLE() (+++) Configure and enable one DMA stream one for managing data transfer from memory to peripheral (input stream). Managing data transfer from peripheral to memory can be performed only using CPU (+++) Associate the initialized DMA handle to the HASH DMA handle using __HAL_LINKDMA() (+++) Configure the priority and enable the NVIC for the transfer complete interrupt on the DMA Stream using HAL_NVIC_SetPriority() and HAL_NVIC_EnableIRQ() (#)Initialize the HASH HAL using HAL_HASH_Init(). This function configures mainly: (##) The data type: 1-bit, 8-bit, 16-bit and 32-bit. (##) For HMAC, the encryption key. (##) For HMAC, the key size used for encryption. (#)Three processing functions are available: (##) Polling mode: processing APIs are blocking functions i.e. they process the data and wait till the digest computation is finished e.g. HAL_HASH_SHA1_Start() (##) Interrupt mode: encryption and decryption APIs are not blocking functions i.e. they process the data under interrupt e.g. HAL_HASH_SHA1_Start_IT() (##) DMA mode: processing APIs are not blocking functions and the CPU is not used for data transfer i.e. the data transfer is ensured by DMA e.g. HAL_HASH_SHA1_Start_DMA() (#)When the processing function is called at first time after HAL_HASH_Init() the HASH peripheral is initialized and processes the buffer in input. After that, the digest computation is started. When processing multi-buffer use the accumulate function to write the data in the peripheral without starting the digest computation. In last buffer use the start function to input the last buffer ans start the digest computation. (##) e.g. HAL_HASH_SHA1_Accumulate() : write 1st data buffer in the peripheral without starting the digest computation (##) write (n-1)th data buffer in the peripheral without starting the digest computation (##) HAL_HASH_SHA1_Start() : write (n)th data buffer in the peripheral and start the digest computation (#)In HMAC mode, there is no Accumulate API. Only Start API is available. (#)In case of using DMA, call the DMA start processing e.g. HAL_HASH_SHA1_Start_DMA(). After that, call the finish function in order to get the digest value e.g. HAL_HASH_SHA1_Finish() (#)Call HAL_HASH_DeInit() to deinitialize the HASH peripheral.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Definition in file stm32f7xx_hal_hash.c.