STM32L486xx HAL User Manual
stm32l4xx_hal_hash_ex.c
Go to the documentation of this file.
00001 /**
00002   ******************************************************************************
00003   * @file    stm32l4xx_hal_hash_ex.c
00004   * @author  MCD Application Team
00005   * @brief   Extended HASH HAL module driver.
00006   *          This file provides firmware functions to manage the following
00007   *          functionalities of the HASH peripheral for SHA-224 and SHA-256
00008   *          alogrithms:
00009   *           + HASH or HMAC processing in polling mode
00010   *           + HASH or HMAC processing in interrupt mode
00011   *           + HASH or HMAC processing in DMA mode
00012   *         Additionally, this file provides functions to manage HMAC
00013   *         multi-buffer DMA-based processing for MD-5, SHA-1, SHA-224
00014   *         and SHA-256.
00015   *
00016   *
00017   @verbatim
00018  ===============================================================================
00019                      ##### HASH peripheral extended features  #####
00020  ===============================================================================
00021     [..]
00022     The SHA-224 and SHA-256 HASH and HMAC processing can be carried out exactly
00023     the same way as for SHA-1 or MD-5 algorithms.
00024     (#) Three modes are available.
00025         (##) Polling mode: processing APIs are blocking functions
00026              i.e. they process the data and wait till the digest computation is finished,
00027              e.g. HAL_HASHEx_xxx_Start()
00028         (##) Interrupt mode: processing APIs are not blocking functions
00029                 i.e. they process the data under interrupt,
00030                 e.g. HAL_HASHEx_xxx_Start_IT()
00031         (##) DMA mode: processing APIs are not blocking functions and the CPU is
00032              not used for data transfer i.e. the data transfer is ensured by DMA,
00033                 e.g. HAL_HASHEx_xxx_Start_DMA(). Note that in DMA mode, a call to
00034                 HAL_HASHEx_xxx_Finish() is then required to retrieve the digest.
00035 
00036    (#)Multi-buffer processing is possible in polling and DMA mode.
00037         (##) In polling mode, only multi-buffer HASH processing is possible.
00038              API HAL_HASHEx_xxx_Accumulate() must be called for each input buffer, except for the last one.
00039              User must resort to HAL_HASHEx_xxx_Start() to enter the last one and retrieve as
00040              well the computed digest.
00041 
00042         (##) In DMA mode, multi-buffer HASH and HMAC processing are possible.
00043 
00044               (+++) HASH processing: once initialization is done, MDMAT bit must be set thru __HAL_HASH_SET_MDMAT() macro.
00045              From that point, each buffer can be fed to the IP thru HAL_HASHEx_xxx_Start_DMA() API.
00046              Before entering the last buffer, reset the MDMAT bit with __HAL_HASH_RESET_MDMAT()
00047              macro then wrap-up the HASH processing in feeding the last input buffer thru the
00048              same API HAL_HASHEx_xxx_Start_DMA(). The digest can then be retrieved with a call to
00049              API HAL_HASHEx_xxx_Finish().
00050 
00051              (+++) HMAC processing (MD-5, SHA-1, SHA-224 and SHA-256 must all resort to
00052              extended functions): after initialization, the key and the first input buffer are entered
00053              in the IP with the API HAL_HMACEx_xxx_Step1_2_DMA(). This carries out HMAC step 1 and
00054              starts step 2.
00055              The following buffers are next entered with the API  HAL_HMACEx_xxx_Step2_DMA(). At this
00056              point, the HMAC processing is still carrying out step 2.
00057              Then, step 2 for the last input buffer and step 3 are carried out by a single call
00058              to HAL_HMACEx_xxx_Step2_3_DMA().
00059 
00060              The digest can finally be retrieved with a call to API HAL_HASH_xxx_Finish() for
00061              MD-5 and SHA-1, to HAL_HASHEx_xxx_Finish() for SHA-224 and SHA-256.
00062 
00063 
00064   @endverbatim
00065   ******************************************************************************
00066   * @attention
00067   *
00068   * <h2><center>&copy; COPYRIGHT(c) 2017 STMicroelectronics</center></h2>
00069   *
00070   * Redistribution and use in source and binary forms, with or without modification,
00071   * are permitted provided that the following conditions are met:
00072   *   1. Redistributions of source code must retain the above copyright notice,
00073   *      this list of conditions and the following disclaimer.
00074   *   2. Redistributions in binary form must reproduce the above copyright notice,
00075   *      this list of conditions and the following disclaimer in the documentation
00076   *      and/or other materials provided with the distribution.
00077   *   3. Neither the name of STMicroelectronics nor the names of its contributors
00078   *      may be used to endorse or promote products derived from this software
00079   *      without specific prior written permission.
00080   *
00081   * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
00082   * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00083   * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
00084   * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
00085   * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
00086   * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
00087   * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
00088   * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
00089   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
00090   * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00091   *
00092   ******************************************************************************
00093   */
00094 
00095 /* Includes ------------------------------------------------------------------*/
00096 #include "stm32l4xx_hal.h"
00097 
00098 #ifdef HAL_HASH_MODULE_ENABLED
00099 
00100 #if defined (STM32L4A6xx) || defined (STM32L4S5xx) || defined (STM32L4S7xx) || defined (STM32L4S9xx)
00101 
00102 /** @addtogroup STM32L4xx_HAL_Driver
00103   * @{
00104   */
00105 
00106 /** @defgroup HASHEx HASHEx
00107   * @brief HASH HAL extended module driver.
00108   * @{
00109   */
00110 
00111 /* Private typedef -----------------------------------------------------------*/
00112 /* Private define ------------------------------------------------------------*/
00113 /* Private functions ---------------------------------------------------------*/
00114 
00115 /** @defgroup HASHEx_Exported_Functions HASH Extended Exported Functions
00116   * @{
00117   */
00118 
00119 
00120 /** @defgroup HASHEx_Exported_Functions_Group1 HASH extended processing functions in polling mode
00121  *  @brief   HASH extended processing functions using polling mode.
00122  *
00123 @verbatim
00124  ===============================================================================
00125                ##### Polling mode HASH extended processing functions #####
00126  ===============================================================================
00127     [..]  This section provides functions allowing to calculate in polling mode
00128           the hash value using one of the following algorithms:
00129       (+) SHA224
00130          (++) HAL_HASHEx_SHA224_Start()
00131          (++) HAL_HASHEx_SHA224_Accumulate()
00132       (+) SHA256
00133          (++) HAL_HASHEx_SHA256_Start()
00134          (++) HAL_HASHEx_SHA256_Accumulate()
00135 
00136     [..] For a single buffer to be hashed, user can resort to HAL_HASH_xxx_Start().
00137 
00138     [..]  In case of multi-buffer HASH processing (a single digest is computed while
00139           several buffers are fed to the IP), the user can resort to successive calls
00140           to HAL_HASHEx_xxx_Accumulate() and wrap-up the digest computation by a call
00141           to HAL_HASHEx_xxx_Start().
00142 
00143 @endverbatim
00144   * @{
00145   */
00146 
00147 
00148 /**
00149   * @brief  Initialize the HASH peripheral in SHA224 mode, next process pInBuffer then
00150   *         read the computed digest.
00151   * @note   Digest is available in pOutBuffer.
00152   * @param  hhash: HASH handle.
00153   * @param  pInBuffer: pointer to the input buffer (buffer to be hashed).
00154   * @param  Size: length of the input buffer in bytes.
00155   * @param  pOutBuffer: pointer to the computed digest. Digest size is 28 bytes.
00156   * @param  Timeout: Timeout value
00157   * @retval HAL status
00158   */
00159 HAL_StatusTypeDef HAL_HASHEx_SHA224_Start(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size, uint8_t* pOutBuffer, uint32_t Timeout)
00160 {
00161   return HASH_Start(hhash, pInBuffer, Size, pOutBuffer, Timeout, HASH_ALGOSELECTION_SHA224);
00162 }
00163 
00164 /**
00165   * @brief  If not already done, initialize the HASH peripheral in SHA224 mode then
00166   *         processes pInBuffer.
00167   * @note   Consecutive calls to HAL_HASHEx_SHA224_Accumulate() can be used to feed
00168   *         several input buffers back-to-back to the IP that will yield a single
00169   *         HASH signature once all buffers have been entered. Wrap-up of input
00170   *         buffers feeding and retrieval of digest is done by a call to
00171   *         HAL_HASHEx_SHA224_Start().
00172   * @note   Field hhash->Phase of HASH handle is tested to check whether or not
00173   *         the IP has already been initialized.
00174   * @note   Digest is not retrieved by this API, user must resort to HAL_HASHEx_SHA224_Start()
00175   *         to read it, feeding at the same time the last input buffer to the IP.
00176   * @note   The input buffer size (in bytes) must be a multiple of 4 otherwise, the
00177   *         HASH digest computation is corrupted. Only HAL_HASHEx_SHA224_Start() is able
00178   *         to manage the ending buffer with a length in bytes not a multiple of 4.
00179   * @param  hhash: HASH handle.
00180   * @param  pInBuffer: pointer to the input buffer (buffer to be hashed).
00181   * @param  Size: length of the input buffer in bytes, must be a multiple of 4.
00182   * @retval HAL status
00183   */
00184 HAL_StatusTypeDef HAL_HASHEx_SHA224_Accumulate(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size)
00185 {
00186   return  HASH_Accumulate(hhash, pInBuffer, Size,HASH_ALGOSELECTION_SHA224);
00187 }
00188 
00189 /**
00190   * @brief  Initialize the HASH peripheral in SHA256 mode, next process pInBuffer then
00191   *         read the computed digest.
00192   * @note   Digest is available in pOutBuffer.
00193   * @param  hhash: HASH handle.
00194   * @param  pInBuffer: pointer to the input buffer (buffer to be hashed).
00195   * @param  Size: length of the input buffer in bytes.
00196   * @param  pOutBuffer: pointer to the computed digest. Digest size is 32 bytes.
00197   * @param  Timeout: Timeout value
00198   * @retval HAL status
00199   */
00200 HAL_StatusTypeDef HAL_HASHEx_SHA256_Start(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size, uint8_t* pOutBuffer, uint32_t Timeout)
00201 {
00202   return HASH_Start(hhash, pInBuffer, Size, pOutBuffer, Timeout, HASH_ALGOSELECTION_SHA256);
00203 }
00204 
00205 /**
00206   * @brief  If not already done, initialize the HASH peripheral in SHA256 mode then
00207   *         processes pInBuffer.
00208   * @note   Consecutive calls to HAL_HASHEx_SHA256_Accumulate() can be used to feed
00209   *         several input buffers back-to-back to the IP that will yield a single
00210   *         HASH signature once all buffers have been entered. Wrap-up of input
00211   *         buffers feeding and retrieval of digest is done by a call to
00212   *         HAL_HASHEx_SHA256_Start().
00213   * @note   Field hhash->Phase of HASH handle is tested to check whether or not
00214   *         the IP has already been initialized.
00215   * @note   Digest is not retrieved by this API, user must resort to HAL_HASHEx_SHA256_Start()
00216   *         to read it, feeding at the same time the last input buffer to the IP.
00217   * @note   The input buffer size (in bytes) must be a multiple of 4 otherwise, the
00218   *         HASH digest computation is corrupted. Only HAL_HASHEx_SHA256_Start() is able
00219   *         to manage the ending buffer with a length in bytes not a multiple of 4.
00220   * @param  hhash: HASH handle.
00221   * @param  pInBuffer: pointer to the input buffer (buffer to be hashed).
00222   * @param  Size: length of the input buffer in bytes, must be a multiple of 4.
00223   * @retval HAL status
00224   */
00225 HAL_StatusTypeDef HAL_HASHEx_SHA256_Accumulate(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size)
00226 {
00227   return  HASH_Accumulate(hhash, pInBuffer, Size,HASH_ALGOSELECTION_SHA256);
00228 }
00229 
00230 
00231 /**
00232   * @}
00233   */
00234 
00235 /** @defgroup HASHEx_Exported_Functions_Group2 HASH extended processing functions in interrupt mode
00236  *  @brief   HASH extended processing functions using interrupt mode.
00237  *
00238 @verbatim
00239  ===============================================================================
00240           ##### Interruption mode HASH extended processing functions #####
00241  ===============================================================================
00242     [..]  This section provides functions allowing to calculate in interrupt mode
00243           the hash value using one of the following algorithms:
00244       (+) SHA224
00245          (++) HAL_HASHEx_SHA224_Start_IT()
00246       (+) SHA256
00247          (++) HAL_HASHEx_SHA256_Start_IT()
00248 
00249 @endverbatim
00250   * @{
00251   */
00252 
00253 
00254 /**
00255   * @brief  Initialize the HASH peripheral in SHA224 mode, next process pInBuffer then
00256   *         read the computed digest in interruption mode.
00257   * @note   Digest is available in pOutBuffer.
00258   * @param  hhash: HASH handle.
00259   * @param  pInBuffer: pointer to the input buffer (buffer to be hashed).
00260   * @param  Size: length of the input buffer in bytes.
00261   * @param  pOutBuffer: pointer to the computed digest. Digest size is 28 bytes.
00262   * @retval HAL status
00263   */
00264 HAL_StatusTypeDef HAL_HASHEx_SHA224_Start_IT(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size, uint8_t* pOutBuffer)
00265 {
00266   return HASH_Start_IT(hhash, pInBuffer, Size, pOutBuffer,HASH_ALGOSELECTION_SHA224);
00267 }
00268 
00269 /**
00270   * @brief  Initialize the HASH peripheral in SHA256 mode, next process pInBuffer then
00271   *         read the computed digest in interruption mode.
00272   * @note   Digest is available in pOutBuffer.
00273   * @param  hhash: HASH handle.
00274   * @param  pInBuffer: pointer to the input buffer (buffer to be hashed).
00275   * @param  Size: length of the input buffer in bytes.
00276   * @param  pOutBuffer: pointer to the computed digest. Digest size is 32 bytes.
00277   * @retval HAL status
00278   */
00279 HAL_StatusTypeDef HAL_HASHEx_SHA256_Start_IT(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size, uint8_t* pOutBuffer)
00280 {
00281   return HASH_Start_IT(hhash, pInBuffer, Size, pOutBuffer,HASH_ALGOSELECTION_SHA256);
00282 }
00283 
00284 /**
00285   * @}
00286   */
00287 
00288 /** @defgroup HASHEx_Exported_Functions_Group3 HASH extended processing functions in DMA mode
00289  *  @brief   HASH extended processing functions using DMA mode.
00290  *
00291 @verbatim
00292  ===============================================================================
00293                 ##### DMA mode HASH extended  processing functionss #####
00294  ===============================================================================
00295     [..]  This section provides functions allowing to calculate in DMA mode
00296           the hash value using one of the following algorithms:
00297       (+) SHA224
00298          (++) HAL_HASHEx_SHA224_Start_DMA()
00299          (++) HAL_HASHEx_SHA224_Finish()
00300       (+) SHA256
00301          (++) HAL_HASHEx_SHA256_Start_DMA()
00302          (++) HAL_HASHEx_SHA256_Finish()
00303 
00304     [..]  When resorting to DMA mode to enter the data in the IP, user must resort
00305           to  HAL_HASHEx_xxx_Start_DMA() then read the resulting digest with
00306           HAL_HASHEx_xxx_Finish().
00307 
00308     [..]  In case of multi-buffer HASH processing, MDMAT bit must first be set before
00309           the successive calls to HAL_HASHEx_xxx_Start_DMA(). Then, MDMAT bit needs to be
00310           reset before the last call to HAL_HASHEx_xxx_Start_DMA(). Digest is finally
00311           retrieved thanks to HAL_HASHEx_xxx_Finish().
00312 
00313 @endverbatim
00314   * @{
00315   */
00316 
00317 
00318 
00319 
00320 /**
00321   * @brief  Initialize the HASH peripheral in SHA224 mode then initiate a DMA transfer
00322   *         to feed the input buffer to the IP.
00323   * @note   Once the DMA transfer is finished, HAL_HASHEx_SHA224_Finish() API must
00324   *         be called to retrieve the computed digest.
00325   * @param  hhash: HASH handle.
00326   * @param  pInBuffer: pointer to the input buffer (buffer to be hashed).
00327   * @param  Size: length of the input buffer in bytes.
00328   * @retval HAL status
00329   */
00330 HAL_StatusTypeDef HAL_HASHEx_SHA224_Start_DMA(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size)
00331 {
00332   return HASH_Start_DMA(hhash, pInBuffer, Size, HASH_ALGOSELECTION_SHA224);
00333 }
00334 
00335 /**
00336   * @brief  Return the computed digest in SHA224 mode.
00337   * @note   The API waits for DCIS to be set then reads the computed digest.
00338   * @note   HAL_HASHEx_SHA224_Finish() can be used as well to retrieve the digest in
00339   *         HMAC SHA224 mode.
00340   * @param  hhash: HASH handle.
00341   * @param  pOutBuffer: pointer to the computed digest. Digest size is 28 bytes.
00342   * @param  Timeout: Timeout value.
00343   * @retval HAL status
00344   */
00345 HAL_StatusTypeDef HAL_HASHEx_SHA224_Finish(HASH_HandleTypeDef *hhash, uint8_t* pOutBuffer, uint32_t Timeout)
00346 {
00347    return HASH_Finish(hhash, pOutBuffer, Timeout);
00348 }
00349 
00350 /**
00351   * @brief  Initialize the HASH peripheral in SHA256 mode then initiate a DMA transfer
00352   *         to feed the input buffer to the IP.
00353   * @note   Once the DMA transfer is finished, HAL_HASHEx_SHA256_Finish() API must
00354   *         be called to retrieve the computed digest.
00355   * @param  hhash: HASH handle.
00356   * @param  pInBuffer: pointer to the input buffer (buffer to be hashed).
00357   * @param  Size: length of the input buffer in bytes.
00358   * @retval HAL status
00359   */
00360 HAL_StatusTypeDef HAL_HASHEx_SHA256_Start_DMA(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size)
00361 {
00362   return HASH_Start_DMA(hhash, pInBuffer, Size, HASH_ALGOSELECTION_SHA256);
00363 }
00364 
00365 /**
00366   * @brief  Return the computed digest in SHA256 mode.
00367   * @note   The API waits for DCIS to be set then reads the computed digest.
00368   * @note   HAL_HASHEx_SHA256_Finish() can be used as well to retrieve the digest in
00369   *         HMAC SHA256 mode.
00370   * @param  hhash: HASH handle.
00371   * @param  pOutBuffer: pointer to the computed digest. Digest size is 32 bytes.
00372   * @param  Timeout: Timeout value.
00373   * @retval HAL status
00374   */
00375 HAL_StatusTypeDef HAL_HASHEx_SHA256_Finish(HASH_HandleTypeDef *hhash, uint8_t* pOutBuffer, uint32_t Timeout)
00376 {
00377    return HASH_Finish(hhash, pOutBuffer, Timeout);
00378 }
00379 
00380 /**
00381   * @}
00382   */
00383 
00384 /** @defgroup HASHEx_Exported_Functions_Group4 HMAC extended processing functions in polling mode
00385  *  @brief   HMAC extended processing functions using polling mode.
00386  *
00387 @verbatim
00388  ===============================================================================
00389              ##### Polling mode HMAC extended processing functions #####
00390  ===============================================================================
00391     [..]  This section provides functions allowing to calculate in polling mode
00392           the HMAC value using one of the following algorithms:
00393       (+) SHA224
00394          (++) HAL_HMACEx_SHA224_Start()
00395       (+) SHA256
00396          (++) HAL_HMACEx_SHA256_Start()
00397 
00398 @endverbatim
00399   * @{
00400   */
00401 
00402 
00403 
00404 /**
00405   * @brief  Initialize the HASH peripheral in HMAC SHA224 mode, next process pInBuffer then
00406   *         read the computed digest.
00407   * @note   Digest is available in pOutBuffer.
00408   * @note   Same key is used for the inner and the outer hash functions; pointer to key and
00409   *         key size are respectively stored in hhash->Init.pKey and hhash->Init.KeySize.
00410   * @param  hhash: HASH handle.
00411   * @param  pInBuffer: pointer to the input buffer (buffer to be hashed).
00412   * @param  Size: length of the input buffer in bytes.
00413   * @param  pOutBuffer: pointer to the computed digest. Digest size is 28 bytes.
00414   * @param  Timeout: Timeout value.
00415   * @retval HAL status
00416   */
00417 HAL_StatusTypeDef HAL_HMACEx_SHA224_Start(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size, uint8_t* pOutBuffer, uint32_t Timeout)
00418 {
00419   return HMAC_Start(hhash, pInBuffer, Size, pOutBuffer, Timeout, HASH_ALGOSELECTION_SHA224);
00420 }
00421 
00422 /**
00423   * @brief  Initialize the HASH peripheral in HMAC SHA256 mode, next process pInBuffer then
00424   *         read the computed digest.
00425   * @note   Digest is available in pOutBuffer.
00426   * @note   Same key is used for the inner and the outer hash functions; pointer to key and
00427   *         key size are respectively stored in hhash->Init.pKey and hhash->Init.KeySize.
00428   * @param  hhash: HASH handle.
00429   * @param  pInBuffer: pointer to the input buffer (buffer to be hashed).
00430   * @param  Size: length of the input buffer in bytes.
00431   * @param  pOutBuffer: pointer to the computed digest. Digest size is 32 bytes.
00432   * @param  Timeout: Timeout value.
00433   * @retval HAL status
00434   */
00435 HAL_StatusTypeDef HAL_HMACEx_SHA256_Start(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size, uint8_t* pOutBuffer, uint32_t Timeout)
00436 {
00437   return HMAC_Start(hhash, pInBuffer, Size, pOutBuffer, Timeout, HASH_ALGOSELECTION_SHA256);
00438 }
00439 
00440 /**
00441   * @}
00442   */
00443 
00444 
00445 /** @defgroup HASHEx_Exported_Functions_Group5 HMAC extended processing functions in interrupt mode
00446  *  @brief   HMAC extended processing functions using interruption mode.
00447  *
00448 @verbatim
00449  ===============================================================================
00450              ##### Interrupt mode HMAC extended processing functions #####
00451  ===============================================================================
00452     [..]  This section provides functions allowing to calculate in interrupt mode
00453           the HMAC value using one of the following algorithms:
00454       (+) SHA224
00455          (++) HAL_HMACEx_SHA224_Start_IT()
00456       (+) SHA256
00457          (++) HAL_HMACEx_SHA256_Start_IT()
00458 
00459 @endverbatim
00460   * @{
00461   */
00462 
00463 
00464 
00465 /**
00466   * @brief  Initialize the HASH peripheral in HMAC SHA224 mode, next process pInBuffer then
00467   *         read the computed digest in interrupt mode.
00468   * @note   Digest is available in pOutBuffer.
00469   * @note   Same key is used for the inner and the outer hash functions; pointer to key and
00470   *         key size are respectively stored in hhash->Init.pKey and hhash->Init.KeySize.
00471   * @param  hhash: HASH handle.
00472   * @param  pInBuffer: pointer to the input buffer (buffer to be hashed).
00473   * @param  Size: length of the input buffer in bytes.
00474   * @param  pOutBuffer: pointer to the computed digest. Digest size is 28 bytes.
00475   * @retval HAL status
00476   */
00477 HAL_StatusTypeDef HAL_HMACEx_SHA224_Start_IT(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size, uint8_t* pOutBuffer)
00478 {
00479   return  HMAC_Start_IT(hhash, pInBuffer, Size, pOutBuffer, HASH_ALGOSELECTION_SHA224);
00480 }
00481 
00482 /**
00483   * @brief  Initialize the HASH peripheral in HMAC SHA256 mode, next process pInBuffer then
00484   *         read the computed digest in interrupt mode.
00485   * @note   Digest is available in pOutBuffer.
00486   * @note   Same key is used for the inner and the outer hash functions; pointer to key and
00487   *         key size are respectively stored in hhash->Init.pKey and hhash->Init.KeySize.
00488   * @param  hhash: HASH handle.
00489   * @param  pInBuffer: pointer to the input buffer (buffer to be hashed).
00490   * @param  Size: length of the input buffer in bytes.
00491   * @param  pOutBuffer: pointer to the computed digest. Digest size is 32 bytes.
00492   * @retval HAL status
00493   */
00494 HAL_StatusTypeDef HAL_HMACEx_SHA256_Start_IT(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size, uint8_t* pOutBuffer)
00495 {
00496   return  HMAC_Start_IT(hhash, pInBuffer, Size, pOutBuffer, HASH_ALGOSELECTION_SHA256);
00497 }
00498 
00499 
00500 
00501 
00502 /**
00503   * @}
00504   */
00505 
00506 
00507 /** @defgroup HASHEx_Exported_Functions_Group6 HMAC extended processing functions in DMA mode
00508  *  @brief   HMAC extended processing functions using DMA mode.
00509  *
00510 @verbatim
00511  ===============================================================================
00512               ##### DMA mode HMAC extended processing functions #####
00513  ===============================================================================
00514     [..]  This section provides functions allowing to calculate in DMA mode
00515           the HMAC value using one of the following algorithms:
00516       (+) SHA224
00517          (++) HAL_HMACEx_SHA224_Start_DMA()
00518       (+) SHA256
00519          (++) HAL_HMACEx_SHA256_Start_DMA()
00520 
00521     [..]  When resorting to DMA mode to enter the data in the IP for HMAC processing,
00522           user must resort to  HAL_HMACEx_xxx_Start_DMA() then read the resulting digest
00523           with HAL_HASHEx_xxx_Finish().
00524 
00525 
00526 @endverbatim
00527   * @{
00528   */
00529 
00530 
00531 
00532 /**
00533   * @brief  Initialize the HASH peripheral in HMAC SHA224 mode then initiate the required
00534   *         DMA transfers to feed the key and the input buffer to the IP.
00535   * @note   Once the DMA transfers are finished (indicated by hhash->State set back
00536   *         to HAL_HASH_STATE_READY), HAL_HASHEx_SHA224_Finish() API must be called to retrieve
00537   *         the computed digest.
00538   * @note   Same key is used for the inner and the outer hash functions; pointer to key and
00539   *         key size are respectively stored in hhash->Init.pKey and hhash->Init.KeySize.
00540   * @note   If MDMAT bit is set before calling this function (multi-buffer
00541   *          HASH processing case), the input buffer size (in bytes) must be
00542   *          a multiple of 4 otherwise, the HASH digest computation is corrupted.
00543   *          For the processing of the last buffer of the thread, MDMAT bit must
00544   *          be reset and the buffer length (in bytes) doesn't have to be a
00545   *          multiple of 4.
00546   * @param  hhash: HASH handle.
00547   * @param  pInBuffer: pointer to the input buffer (buffer to be hashed).
00548   * @param  Size: length of the input buffer in bytes.
00549   * @retval HAL status
00550   */
00551 HAL_StatusTypeDef HAL_HMACEx_SHA224_Start_DMA(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size)
00552 {
00553   return  HMAC_Start_DMA(hhash, pInBuffer, Size, HASH_ALGOSELECTION_SHA224);
00554 }
00555 
00556 /**
00557   * @brief  Initialize the HASH peripheral in HMAC SHA224 mode then initiate the required
00558   *         DMA transfers to feed the key and the input buffer to the IP.
00559   * @note   Once the DMA transfers are finished (indicated by hhash->State set back
00560   *         to HAL_HASH_STATE_READY), HAL_HASHEx_SHA256_Finish() API must be called to retrieve
00561   *         the computed digest.
00562   * @note   Same key is used for the inner and the outer hash functions; pointer to key and
00563   *         key size are respectively stored in hhash->Init.pKey and hhash->Init.KeySize.
00564   * @note   If MDMAT bit is set before calling this function (multi-buffer
00565   *          HASH processing case), the input buffer size (in bytes) must be
00566   *          a multiple of 4 otherwise, the HASH digest computation is corrupted.
00567   *          For the processing of the last buffer of the thread, MDMAT bit must
00568   *          be reset and the buffer length (in bytes) doesn't have to be a
00569   *          multiple of 4.
00570   * @param  hhash: HASH handle.
00571   * @param  pInBuffer: pointer to the input buffer (buffer to be hashed).
00572   * @param  Size: length of the input buffer in bytes.
00573   * @retval HAL status
00574   */
00575 HAL_StatusTypeDef HAL_HMACEx_SHA256_Start_DMA(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size)
00576 {
00577   return  HMAC_Start_DMA(hhash, pInBuffer, Size, HASH_ALGOSELECTION_SHA256);
00578 }
00579 
00580 
00581 /**
00582   * @}
00583   */
00584 
00585 /** @defgroup HASHEx_Exported_Functions_Group7 Multi-buffer HMAC extended processing functions in DMA mode
00586  *  @brief   HMAC extended processing functions in multi-buffer DMA mode.
00587  *
00588 @verbatim
00589  ===============================================================================
00590       ##### Multi-buffer DMA mode HMAC extended processing functions #####
00591  ===============================================================================
00592     [..]  This section provides functions to manage HMAC multi-buffer
00593           DMA-based processing for MD5, SHA1, SHA224 and SHA256 algorithms.
00594       (+) MD5
00595          (++) HAL_HMACEx_MD5_Step1_2_DMA()
00596          (++) HAL_HMACEx_MD5_Step2_DMA()
00597          (++) HAL_HMACEx_MD5_Step2_3_DMA()
00598       (+) SHA1
00599          (++) HAL_HMACEx_SHA1_Step1_2_DMA()
00600          (++) HAL_HMACEx_SHA1_Step2_DMA()
00601          (++) HAL_HMACEx_SHA1_Step2_3_DMA()
00602       (+) SHA256
00603          (++) HAL_HMACEx_SHA224_Step1_2_DMA()
00604          (++) HAL_HMACEx_SHA224_Step2_DMA()
00605          (++) HAL_HMACEx_SHA224_Step2_3_DMA()
00606       (+) SHA256
00607          (++) HAL_HMACEx_SHA256_Step1_2_DMA()
00608          (++) HAL_HMACEx_SHA256_Step2_DMA()
00609          (++) HAL_HMACEx_SHA256_Step2_3_DMA()
00610 
00611     [..]  User must first start-up the multi-buffer DMA-based HMAC computation in
00612           calling HAL_HMACEx_xxx_Step1_2_DMA(). This carries out HMAC step 1 and
00613           intiates step 2 with the first input buffer.
00614 
00615     [..]  The following buffers are next fed to the IP with a call to the API
00616           HAL_HMACEx_xxx_Step2_DMA(). There may be several consecutive calls
00617           to this API.
00618 
00619     [..]  Multi-buffer DMA-based HMAC computation is wrapped up by a call to
00620           HAL_HMACEx_xxx_Step2_3_DMA(). This finishes step 2 in feeding the last input
00621           buffer to the IP then carries out step 3.
00622 
00623     [..]  Digest is retrieved by a call to HAL_HASH_xxx_Finish() for MD-5 or
00624           SHA-1, to HAL_HASHEx_xxx_Finish() for SHA-224 or SHA-256.
00625 
00626     [..]  If only two buffers need to be consecutively processed, a call to
00627           HAL_HMACEx_xxx_Step1_2_DMA() followed by a call to HAL_HMACEx_xxx_Step2_3_DMA()
00628           is sufficient.
00629 
00630 @endverbatim
00631   * @{
00632   */
00633 
00634 /**
00635   * @brief  MD5 HMAC step 1 completion and step 2 start in multi-buffer DMA mode.
00636   * @note   Step 1 consists in writing the inner hash function key in the IP,
00637   *         step 2 consists in writing the message text.
00638   * @note   The API carries out the HMAC step 1 then starts step 2 with
00639   *         the first buffer entered to the IP. DCAL bit is not automatically set after
00640   *         the message buffer feeding, allowing other messages DMA transfers to occur.
00641   * @note   Same key is used for the inner and the outer hash functions; pointer to key and
00642   *         key size are respectively stored in hhash->Init.pKey and hhash->Init.KeySize.
00643   * @note   The input buffer size (in bytes) must be a multiple of 4 otherwise, the
00644   *         HASH digest computation is corrupted.
00645   * @param  hhash: HASH handle.
00646   * @param  pInBuffer: pointer to the input buffer (message buffer).
00647   * @param  Size: length of the input buffer in bytes.
00648   * @retval HAL status
00649   */
00650 HAL_StatusTypeDef HAL_HMACEx_MD5_Step1_2_DMA(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size)
00651 {
00652   hhash->DigestCalculationDisable = SET;
00653   return  HMAC_Start_DMA(hhash, pInBuffer, Size, HASH_ALGOSELECTION_MD5);
00654 }
00655 
00656 /**
00657   * @brief  MD5 HMAC step 2 in multi-buffer DMA mode.
00658   * @note   Step 2 consists in writing the message text in the IP.
00659   * @note   The API carries on the HMAC step 2, applied to the buffer entered as input
00660   *         parameter. DCAL bit is not automatically set after the message buffer feeding,
00661   *         allowing other messages DMA transfers to occur.
00662   * @note   Same key is used for the inner and the outer hash functions; pointer to key and
00663   *         key size are respectively stored in hhash->Init.pKey and hhash->Init.KeySize.
00664   * @note   The input buffer size (in bytes) must be a multiple of 4 otherwise, the
00665   *         HASH digest computation is corrupted.
00666   * @param  hhash: HASH handle.
00667   * @param  pInBuffer: pointer to the input buffer (message buffer).
00668   * @param  Size: length of the input buffer in bytes.
00669   * @retval HAL status
00670   */
00671 HAL_StatusTypeDef HAL_HMACEx_MD5_Step2_DMA(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size)
00672 {
00673   if (hhash->DigestCalculationDisable != SET)
00674   {
00675     return HAL_ERROR;
00676   }
00677   return  HMAC_Start_DMA(hhash, pInBuffer, Size, HASH_ALGOSELECTION_MD5);
00678 }
00679 
00680 /**
00681   * @brief  MD5 HMAC step 2 wrap-up and step 3 completion in multi-buffer DMA mode.
00682   * @note   Step 2 consists in writing the message text in the IP,
00683   *         step 3 consists in writing the outer hash function key.
00684   * @note   The API wraps up the HMAC step 2 in processing the buffer entered as input
00685   *         parameter (the input buffer must be the last one of the multi-buffer thread)
00686   *         then carries out HMAC step 3.
00687   * @note   Same key is used for the inner and the outer hash functions; pointer to key and
00688   *         key size are respectively stored in hhash->Init.pKey and hhash->Init.KeySize.
00689   * @note   Once the DMA transfers are finished (indicated by hhash->State set back
00690   *         to HAL_HASH_STATE_READY), HAL_HASHEx_SHA256_Finish() API must be called to retrieve
00691   *         the computed digest.
00692   * @param  hhash: HASH handle.
00693   * @param  pInBuffer: pointer to the input buffer (message buffer).
00694   * @param  Size: length of the input buffer in bytes.
00695   * @retval HAL status
00696   */
00697 HAL_StatusTypeDef HAL_HMACEx_MD5_Step2_3_DMA(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size)
00698 {
00699   hhash->DigestCalculationDisable = RESET;
00700   return  HMAC_Start_DMA(hhash, pInBuffer, Size, HASH_ALGOSELECTION_MD5);
00701 }
00702 
00703 
00704 /**
00705   * @brief  SHA1 HMAC step 1 completion and step 2 start in multi-buffer DMA mode.
00706   * @note   Step 1 consists in writing the inner hash function key in the IP,
00707   *         step 2 consists in writing the message text.
00708   * @note   The API carries out the HMAC step 1 then starts step 2 with
00709   *         the first buffer entered to the IP. DCAL bit is not automatically set after
00710   *         the message buffer feeding, allowing other messages DMA transfers to occur.
00711   * @note   Same key is used for the inner and the outer hash functions; pointer to key and
00712   *         key size are respectively stored in hhash->Init.pKey and hhash->Init.KeySize.
00713   * @note   The input buffer size (in bytes) must be a multiple of 4 otherwise, the
00714   *         HASH digest computation is corrupted.
00715   * @param  hhash: HASH handle.
00716   * @param  pInBuffer: pointer to the input buffer (message buffer).
00717   * @param  Size: length of the input buffer in bytes.
00718   * @retval HAL status
00719   */
00720 HAL_StatusTypeDef HAL_HMACEx_SHA1_Step1_2_DMA(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size)
00721 {
00722   hhash->DigestCalculationDisable = SET;
00723   return  HMAC_Start_DMA(hhash, pInBuffer, Size, HASH_ALGOSELECTION_SHA1);
00724 }
00725 
00726 /**
00727   * @brief  SHA1 HMAC step 2 in multi-buffer DMA mode.
00728   * @note   Step 2 consists in writing the message text in the IP.
00729   * @note   The API carries on the HMAC step 2, applied to the buffer entered as input
00730   *         parameter. DCAL bit is not automatically set after the message buffer feeding,
00731   *         allowing other messages DMA transfers to occur.
00732   * @note   Same key is used for the inner and the outer hash functions; pointer to key and
00733   *         key size are respectively stored in hhash->Init.pKey and hhash->Init.KeySize.
00734   * @note   The input buffer size (in bytes) must be a multiple of 4 otherwise, the
00735   *         HASH digest computation is corrupted.
00736   * @param  hhash: HASH handle.
00737   * @param  pInBuffer: pointer to the input buffer (message buffer).
00738   * @param  Size: length of the input buffer in bytes.
00739   * @retval HAL status
00740   */
00741 HAL_StatusTypeDef HAL_HMACEx_SHA1_Step2_DMA(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size)
00742 {
00743   if (hhash->DigestCalculationDisable != SET)
00744   {
00745     return HAL_ERROR;
00746   }
00747   return  HMAC_Start_DMA(hhash, pInBuffer, Size, HASH_ALGOSELECTION_SHA1);
00748 }
00749 
00750 /**
00751   * @brief  SHA1 HMAC step 2 wrap-up and step 3 completion in multi-buffer DMA mode.
00752   * @note   Step 2 consists in writing the message text in the IP,
00753   *         step 3 consists in writing the outer hash function key.
00754   * @note   The API wraps up the HMAC step 2 in processing the buffer entered as input
00755   *         parameter (the input buffer must be the last one of the multi-buffer thread)
00756   *         then carries out HMAC step 3.
00757   * @note   Same key is used for the inner and the outer hash functions; pointer to key and
00758   *         key size are respectively stored in hhash->Init.pKey and hhash->Init.KeySize.
00759   * @note   Once the DMA transfers are finished (indicated by hhash->State set back
00760   *         to HAL_HASH_STATE_READY), HAL_HASHEx_SHA256_Finish() API must be called to retrieve
00761   *         the computed digest.
00762   * @param  hhash: HASH handle.
00763   * @param  pInBuffer: pointer to the input buffer (message buffer).
00764   * @param  Size: length of the input buffer in bytes.
00765   * @retval HAL status
00766   */
00767 HAL_StatusTypeDef HAL_HMACEx_SHA1_Step2_3_DMA(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size)
00768 {
00769   hhash->DigestCalculationDisable = RESET;
00770   return  HMAC_Start_DMA(hhash, pInBuffer, Size, HASH_ALGOSELECTION_SHA1);
00771 }
00772 
00773 /**
00774   * @brief  SHA224 HMAC step 1 completion and step 2 start in multi-buffer DMA mode.
00775   * @note   Step 1 consists in writing the inner hash function key in the IP,
00776   *         step 2 consists in writing the message text.
00777   * @note   The API carries out the HMAC step 1 then starts step 2 with
00778   *         the first buffer entered to the IP. DCAL bit is not automatically set after
00779   *         the message buffer feeding, allowing other messages DMA transfers to occur.
00780   * @note   Same key is used for the inner and the outer hash functions; pointer to key and
00781   *         key size are respectively stored in hhash->Init.pKey and hhash->Init.KeySize.
00782   * @note   The input buffer size (in bytes) must be a multiple of 4 otherwise, the
00783   *         HASH digest computation is corrupted.
00784   * @param  hhash: HASH handle.
00785   * @param  pInBuffer: pointer to the input buffer (message buffer).
00786   * @param  Size: length of the input buffer in bytes.
00787   * @retval HAL status
00788   */
00789 HAL_StatusTypeDef HAL_HMACEx_SHA224_Step1_2_DMA(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size)
00790 {
00791   hhash->DigestCalculationDisable = SET;
00792   return  HMAC_Start_DMA(hhash, pInBuffer, Size, HASH_ALGOSELECTION_SHA224);
00793 }
00794 
00795 /**
00796   * @brief  SHA224 HMAC step 2 in multi-buffer DMA mode.
00797   * @note   Step 2 consists in writing the message text in the IP.
00798   * @note   The API carries on the HMAC step 2, applied to the buffer entered as input
00799   *         parameter. DCAL bit is not automatically set after the message buffer feeding,
00800   *         allowing other messages DMA transfers to occur.
00801   * @note   Same key is used for the inner and the outer hash functions; pointer to key and
00802   *         key size are respectively stored in hhash->Init.pKey and hhash->Init.KeySize.
00803   * @note   The input buffer size (in bytes) must be a multiple of 4 otherwise, the
00804   *         HASH digest computation is corrupted.
00805   * @param  hhash: HASH handle.
00806   * @param  pInBuffer: pointer to the input buffer (message buffer).
00807   * @param  Size: length of the input buffer in bytes.
00808   * @retval HAL status
00809   */
00810 HAL_StatusTypeDef HAL_HMACEx_SHA224_Step2_DMA(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size)
00811 {
00812   if (hhash->DigestCalculationDisable != SET)
00813   {
00814     return HAL_ERROR;
00815   }
00816   return  HMAC_Start_DMA(hhash, pInBuffer, Size, HASH_ALGOSELECTION_SHA224);
00817 }
00818 
00819 /**
00820   * @brief  SHA224 HMAC step 2 wrap-up and step 3 completion in multi-buffer DMA mode.
00821   * @note   Step 2 consists in writing the message text in the IP,
00822   *         step 3 consists in writing the outer hash function key.
00823   * @note   The API wraps up the HMAC step 2 in processing the buffer entered as input
00824   *         parameter (the input buffer must be the last one of the multi-buffer thread)
00825   *         then carries out HMAC step 3.
00826   * @note   Same key is used for the inner and the outer hash functions; pointer to key and
00827   *         key size are respectively stored in hhash->Init.pKey and hhash->Init.KeySize.
00828   * @note   Once the DMA transfers are finished (indicated by hhash->State set back
00829   *         to HAL_HASH_STATE_READY), HAL_HASHEx_SHA256_Finish() API must be called to retrieve
00830   *         the computed digest.
00831   * @param  hhash: HASH handle.
00832   * @param  pInBuffer: pointer to the input buffer (message buffer).
00833   * @param  Size: length of the input buffer in bytes.
00834   * @retval HAL status
00835   */
00836 HAL_StatusTypeDef HAL_HMACEx_SHA224_Step2_3_DMA(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size)
00837 {
00838   hhash->DigestCalculationDisable = RESET;
00839   return  HMAC_Start_DMA(hhash, pInBuffer, Size, HASH_ALGOSELECTION_SHA224);
00840 }
00841 
00842 /**
00843   * @brief  SHA256 HMAC step 1 completion and step 2 start in multi-buffer DMA mode.
00844   * @note   Step 1 consists in writing the inner hash function key in the IP,
00845   *         step 2 consists in writing the message text.
00846   * @note   The API carries out the HMAC step 1 then starts step 2 with
00847   *         the first buffer entered to the IP. DCAL bit is not automatically set after
00848   *         the message buffer feeding, allowing other messages DMA transfers to occur.
00849   * @note   Same key is used for the inner and the outer hash functions; pointer to key and
00850   *         key size are respectively stored in hhash->Init.pKey and hhash->Init.KeySize.
00851   * @note   The input buffer size (in bytes) must be a multiple of 4 otherwise, the
00852   *         HASH digest computation is corrupted.
00853   * @param  hhash: HASH handle.
00854   * @param  pInBuffer: pointer to the input buffer (message buffer).
00855   * @param  Size: length of the input buffer in bytes.
00856   * @retval HAL status
00857   */
00858 HAL_StatusTypeDef HAL_HMACEx_SHA256_Step1_2_DMA(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size)
00859 {
00860   hhash->DigestCalculationDisable = SET;
00861   return  HMAC_Start_DMA(hhash, pInBuffer, Size, HASH_ALGOSELECTION_SHA256);
00862 }
00863 
00864 /**
00865   * @brief  SHA256 HMAC step 2 in multi-buffer DMA mode.
00866   * @note   Step 2 consists in writing the message text in the IP.
00867   * @note   The API carries on the HMAC step 2, applied to the buffer entered as input
00868   *         parameter. DCAL bit is not automatically set after the message buffer feeding,
00869   *         allowing other messages DMA transfers to occur.
00870   * @note   Same key is used for the inner and the outer hash functions; pointer to key and
00871   *         key size are respectively stored in hhash->Init.pKey and hhash->Init.KeySize.
00872   * @note   The input buffer size (in bytes) must be a multiple of 4 otherwise, the
00873   *         HASH digest computation is corrupted.
00874   * @param  hhash: HASH handle.
00875   * @param  pInBuffer: pointer to the input buffer (message buffer).
00876   * @param  Size: length of the input buffer in bytes.
00877   * @retval HAL status
00878   */
00879 HAL_StatusTypeDef HAL_HMACEx_SHA256_Step2_DMA(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size)
00880 {
00881   if (hhash->DigestCalculationDisable != SET)
00882   {
00883     return HAL_ERROR;
00884   }
00885   return  HMAC_Start_DMA(hhash, pInBuffer, Size, HASH_ALGOSELECTION_SHA256);
00886 }
00887 
00888 /**
00889   * @brief  SHA256 HMAC step 2 wrap-up and step 3 completion in multi-buffer DMA mode.
00890   * @note   Step 2 consists in writing the message text in the IP,
00891   *         step 3 consists in writing the outer hash function key.
00892   * @note   The API wraps up the HMAC step 2 in processing the buffer entered as input
00893   *         parameter (the input buffer must be the last one of the multi-buffer thread)
00894   *         then carries out HMAC step 3.
00895   * @note   Same key is used for the inner and the outer hash functions; pointer to key and
00896   *         key size are respectively stored in hhash->Init.pKey and hhash->Init.KeySize.
00897   * @note   Once the DMA transfers are finished (indicated by hhash->State set back
00898   *         to HAL_HASH_STATE_READY), HAL_HASHEx_SHA256_Finish() API must be called to retrieve
00899   *         the computed digest.
00900   * @param  hhash: HASH handle.
00901   * @param  pInBuffer: pointer to the input buffer (message buffer).
00902   * @param  Size: length of the input buffer in bytes.
00903   * @retval HAL status
00904   */
00905 HAL_StatusTypeDef HAL_HMACEx_SHA256_Step2_3_DMA(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size)
00906 {
00907   hhash->DigestCalculationDisable = RESET;
00908   return  HMAC_Start_DMA(hhash, pInBuffer, Size, HASH_ALGOSELECTION_SHA256);
00909 }
00910 
00911 /**
00912   * @}
00913   */
00914 
00915 
00916 /**
00917   * @}
00918   */
00919 
00920 /**
00921   * @}
00922   */
00923 
00924 /**
00925   * @}
00926   */
00927 
00928 #endif /* defined (STM32L4A6xx) || defined (STM32L4S5xx) || defined (STM32L4S7xx) || defined (STM32L4S9xx) */
00929 
00930 #endif /* HAL_HASH_MODULE_ENABLED */
00931 
00932 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/