STM32H735xx HAL User Manual
Functions
stm32h7xx_hal_otfdec.c File Reference

OTFDEC HAL module driver. This file provides firmware functions to manage the following functionalities of the On-The-Fly Decryption (OTFDEC) peripheral: + Initialization and de-initialization functions + Region setting/enable functions + Peripheral State functions. More...

#include "stm32h7xx_hal.h"

Go to the source code of this file.

Functions

HAL_StatusTypeDef HAL_OTFDEC_Init (OTFDEC_HandleTypeDef *hotfdec)
 Initialize the OTFDEC peripheral and create the associated handle.
HAL_StatusTypeDef HAL_OTFDEC_DeInit (OTFDEC_HandleTypeDef *hotfdec)
 DeInitialize the OTFDEC peripheral.
__weak void HAL_OTFDEC_MspInit (OTFDEC_HandleTypeDef *hotfdec)
 Initialize the OTFDEC MSP.
__weak void HAL_OTFDEC_MspDeInit (OTFDEC_HandleTypeDef *hotfdec)
 DeInitialize OTFDEC MSP.
HAL_StatusTypeDef HAL_OTFDEC_RegisterCallback (OTFDEC_HandleTypeDef *hotfdec, HAL_OTFDEC_CallbackIDTypeDef CallbackID, pOTFDEC_CallbackTypeDef pCallback)
 Register a User OTFDEC Callback To be used instead of the weak predefined callback.
HAL_StatusTypeDef HAL_OTFDEC_UnRegisterCallback (OTFDEC_HandleTypeDef *hotfdec, HAL_OTFDEC_CallbackIDTypeDef CallbackID)
 Unregister a OTFDEC Callback OTFDEC callback is redirected to the weak predefined callback.
void HAL_OTFDEC_IRQHandler (OTFDEC_HandleTypeDef *hotfdec)
 Handle OTFDEC interrupt request.
__weak void HAL_OTFDEC_ErrorCallback (OTFDEC_HandleTypeDef *hotfdec)
 OTFDEC error callback.
HAL_StatusTypeDef HAL_OTFDEC_RegionKeyLock (OTFDEC_HandleTypeDef *hotfdec, uint32_t RegionIndex)
 Lock region keys.
HAL_StatusTypeDef HAL_OTFDEC_RegionSetKey (OTFDEC_HandleTypeDef *hotfdec, uint32_t RegionIndex, uint32_t *pKey)
 Set region keys.
HAL_StatusTypeDef HAL_OTFDEC_RegionSetMode (OTFDEC_HandleTypeDef *hotfdec, uint32_t RegionIndex, uint32_t mode)
 Set region mode.
HAL_StatusTypeDef HAL_OTFDEC_RegionConfig (OTFDEC_HandleTypeDef *hotfdec, uint32_t RegionIndex, OTFDEC_RegionConfigTypeDef *Config, uint32_t lock)
 Set region configuration.
uint32_t HAL_OTFDEC_KeyCRCComputation (uint32_t *pKey)
 Compute Key CRC.
HAL_StatusTypeDef HAL_OTFDEC_RegionEnable (OTFDEC_HandleTypeDef *hotfdec, uint32_t RegionIndex)
 Enable region deciphering.
HAL_StatusTypeDef HAL_OTFDEC_RegionDisable (OTFDEC_HandleTypeDef *hotfdec, uint32_t RegionIndex)
 Disable region deciphering.
HAL_OTFDEC_StateTypeDef HAL_OTFDEC_GetState (OTFDEC_HandleTypeDef *hotfdec)
 Return the OTFDEC state.
uint32_t HAL_OTFDEC_RegionGetKeyCRC (OTFDEC_HandleTypeDef *hotfdec, uint32_t RegionIndex)
 Return region keys CRC.
HAL_StatusTypeDef HAL_OTFDEC_RegionGetConfig (OTFDEC_HandleTypeDef *hotfdec, uint32_t RegionIndex, OTFDEC_RegionConfigTypeDef *Config)
 Return region configuration parameters.

Detailed Description

OTFDEC HAL module driver. This file provides firmware functions to manage the following functionalities of the On-The-Fly Decryption (OTFDEC) peripheral: + Initialization and de-initialization functions + Region setting/enable functions + Peripheral State functions.

Author:
MCD Application Team
Attention:

Copyright (c) 2018 STMicroelectronics. All rights reserved.

This software is licensed under terms that can be found in the LICENSE file in the root directory of this software component. If no LICENSE file comes with this software, it is provided AS-IS.

  ==============================================================================
                     ##### How to use this driver #####
  ==============================================================================
 [..]
    The OTFDEC HAL driver can be used as follows:

    (#) Declare an OTFDEC_HandleTypeDef handle structure (eg. OTFDEC_HandleTypeDef hotfdec).

    (#) Initialize the OTFDEC low level resources by implementing the HAL_OTFDEC_MspInit() API:
        (++) Enable the OTFDEC interface clock.
        (++) NVIC configuration if interrupts are used
            (+++) Configure the OTFDEC interrupt priority.
            (+++) Enable the NVIC OTFDEC IRQ handle.

    (#) Initialize the OTFDEC peripheral by calling the HAL_OTFDEC_Init() API.

    (#) For each region,

        (++) Configure the region deciphering mode by calling the HAL_OTFDEC_RegionSetMode() API.

        (++) Write the region Key by calling the HAL_OTFDEC_RegionSetKey() API. If desired,
        read the key CRC by calling HAL_OTFDEC_RegionGetKeyCRC() API and compare the
        result with the theoretically expected CRC.

        (++) Initialize the OTFDEC region config structure with the Nonce, protected
        region start and end addresses and firmware version, and wrap-up the region
        configuration by calling HAL_OTFDEC_RegionConfig() API.

    (#) At this point, the OTFDEC region configuration is done and the deciphering
        is enabled. The region can be deciphered on the fly after having made sure
        the OctoSPI is configured in memory-mapped mode.

    [..]
    (@) Warning: the OTFDEC deciphering is based on a different endianness compared
        to the AES-CTR as implemented in the AES peripheral. E.g., if the OTFEC
        resorts to the Key (B0, B1, B2, B3) where Bi are 32-bit longwords and B0
        is the Least Significant Word, the AES has to be configured with the Key
        (B3, B2, B1, B0) to report the same result (with the same swapping applied
        to the Initialization Vector).

    [..]

    *** Callback registration ***
    =============================================
    [..]

     The compilation flag USE_HAL_OTFDEC_REGISTER_CALLBACKS, when set to 1,
     allows the user to configure dynamically the driver callbacks.
     Use Functions HAL_OTFDEC_RegisterCallback()
     to register an interrupt callback.
    [..]

     Function HAL_OTFDEC_RegisterCallback() allows to register following callbacks:
       (+) ErrorCallback                  : OTFDEC error callback
       (+) MspInitCallback                : OTFDEC Msp Init callback
       (+) MspDeInitCallback              : OTFDEC Msp DeInit callback
     This function takes as parameters the HAL peripheral handle, the Callback ID
     and a pointer to the user callback function.
    [..]

     Use function HAL_OTFDEC_UnRegisterCallback to reset a callback to the default
     weak function.
    [..]

     HAL_OTFDEC_UnRegisterCallback takes as parameters the HAL peripheral handle,
     and the Callback ID.
     This function allows to reset following callbacks:
       (+) ErrorCallback                  : OTFDEC error callback
       (+) MspInitCallback                : OTFDEC Msp Init callback
       (+) MspDeInitCallback              : OTFDEC Msp DeInit callback
     [..]

     By default, after the HAL_OTFDEC_Init() and when the state is HAL_OTFDEC_STATE_RESET
     all callbacks are set to the corresponding weak functions:
     example HAL_OTFDEC_ErrorCallback().
     Exception done for MspInit and MspDeInit functions that are
     reset to the legacy weak functions in the HAL_OTFDEC_Init()/ HAL_OTFDEC_DeInit() only when
     these callbacks are null (not registered beforehand).
    [..]

     If MspInit or MspDeInit are not null, the HAL_OTFDEC_Init()/ HAL_OTFDEC_DeInit()
     keep and use the user MspInit/MspDeInit callbacks (registered beforehand) whatever the state.
     [..]

     Callbacks can be registered/unregistered in HAL_OTFDEC_STATE_READY state only.
     Exception done MspInit/MspDeInit functions that can be registered/unregistered
     in HAL_OTFDEC_STATE_READY or HAL_OTFDEC_STATE_RESET state,
     thus registered (user) MspInit/DeInit callbacks can be used during the Init/DeInit.
    [..]

     Then, the user first registers the MspInit/MspDeInit user callbacks
     using HAL_OTFDEC_RegisterCallback() before calling HAL_OTFDEC_DeInit()
     or HAL_OTFDEC_Init() function.
     [..]

     When the compilation flag USE_HAL_OTFDEC_REGISTER_CALLBACKS is set to 0 or
     not defined, the callback registration feature is not available and all callbacks
     are set to the corresponding weak functions.

  

Definition in file stm32h7xx_hal_otfdec.c.