MCUXpresso SDK API Reference Manual
Rev. 0
NXP Semiconductors
|
The MCUXpresso SDK provides a peripheral driver for the Bus Encryption Engine (BEE) module.
The BEE module is implemented as an on-the-fly decryption engine. The main features of the BEE module are:
The known hardware limitations of the BEE module are as follows:
The function BEE_Init() initializes the BEE to default values. The function BEE_GetDefaultConfig() loads default values to the BEE configuration structure. The default values are described below.
See the driver examples codes located at <SDK_ROOT>/boards/<BOARD>/driver_examples/bee. The function BEE_Deinit() performs a hardware reset of BEE module and disables clocks. Configuration and keys from software for both regions are cleared.
The function BEE_Enable() enables decryption using BEE. The function BEE_Disable() disables decryption using BEE.
The function BEE_SetConfig() sets BEE settings according to given configuration structure. The structure is described below.
See the driver examples codes located at <SDK_ROOT>/boards/<BOARD>/driver_examples/bee. The function BEE_SetRegionKey() loads given AES key to BEE register for the given region. The key must be 32-bit aligned and stored in little-endian format. Note that eFuse BEE_KEYx_SEL must be set accordingly to be able to load and use the key loaded in BEE registers. Otherwise, the key cannot be loaded and BEE uses the key from OTPMK or SW_GP2.
The function BEE_SetRegionNonce() loads given AES nonce (used only for AES CTR mode) to BEE register for the given region. The nonce must be 32-bit aligned and stored in little-endian format.
Provides functions to get and clear the BEE status.
The function BEE_GetStatusFlags() returns status of BEE peripheral. The function BEE_ClearStatusFlags() clears the BEE status flags.
Refer to the driver examples codes located at <SDK_ROOT>/boards/<BOARD>/driver_examples/bee
Data Structures | |
struct | bee_region_config_t |
BEE region configuration structure. More... | |
Enumerations | |
enum | bee_aes_mode_t { kBEE_AesEcbMode = 0U, kBEE_AesCtrMode = 1U } |
BEE aes mode. More... | |
enum | bee_region_t { kBEE_Region0 = 0U, kBEE_Region1 = 1U } |
BEE region. More... | |
enum | bee_ac_prot_enable { kBEE_AccessProtDisabled = 0U, kBEE_AccessProtEnabled = 1U } |
BEE ac prot enable. More... | |
enum | bee_endian_swap_enable { kBEE_EndianSwapDisabled = 1U, kBEE_EndianSwapEnabled = 0U } |
BEE endian swap enable. More... | |
enum | bee_security_level { kBEE_SecurityLevel0 = 0U, kBEE_SecurityLevel1 = 1U, kBEE_SecurityLevel2 = 2U, kBEE_SecurityLevel3 = 3U } |
BEE security level. More... | |
enum | bee_status_flags_t { kBEE_DisableAbortFlag = 1U, kBEE_Reg0ReadSecViolation = 2U, kBEE_ReadIllegalAccess = 4U, kBEE_Reg1ReadSecViolation = 8U, kBEE_Reg0AccessViolation = 16U, kBEE_Reg1AccessViolation = 32U, kBEE_IdleFlag = BEE_STATUS_BEE_IDLE_MASK } |
BEE status flags. More... | |
Functions | |
void | BEE_Init (BEE_Type *base) |
Resets BEE module to factory default values. More... | |
void | BEE_Deinit (BEE_Type *base) |
Resets BEE module, clears keys for both regions and disables clock to the BEE. More... | |
static void | BEE_Enable (BEE_Type *base) |
Enables BEE decryption. More... | |
static void | BEE_Disable (BEE_Type *base) |
Disables BEE decryption. More... | |
void | BEE_GetDefaultConfig (bee_region_config_t *config) |
Loads default values to the BEE region configuration structure. More... | |
void | BEE_SetConfig (BEE_Type *base, const bee_region_config_t *config) |
Sets BEE configuration. More... | |
status_t | BEE_SetRegionKey (BEE_Type *base, bee_region_t region, const uint8_t *key, size_t keySize) |
Loads the AES key for selected region into BEE key registers. More... | |
status_t | BEE_SetRegionNonce (BEE_Type *base, bee_region_t region, const uint8_t *nonce, size_t nonceSize) |
Loads the nonce for selected region into BEE nonce registers. More... | |
uint32_t | BEE_GetStatusFlags (BEE_Type *base) |
Gets the BEE status flags. More... | |
void | BEE_ClearStatusFlags (BEE_Type *base, uint32_t mask) |
Clears the BEE status flags. More... | |
Driver version | |
#define | FSL_BEE_DRIVER_VERSION (MAKE_VERSION(2, 0, 2)) |
BEE driver version. More... | |
struct bee_region_config_t |
Data Fields | |
bee_aes_mode_t | region0Mode |
AES mode used for encryption/decryption for region 0. | |
bee_aes_mode_t | region1Mode |
AES mode used for encryption/decryption for region 1. | |
uint32_t | region0AddrOffset |
Region 0 address offset. | |
uint32_t | region1AddrOffset |
Region 1 address offset. | |
bee_security_level | region0SecLevel |
Region 0 security level. | |
bee_security_level | region1SecLevel |
Region 1 security level. | |
uint32_t | region1Bot |
Region 1 bottom address. | |
uint32_t | region1Top |
Region 1 top address. | |
bee_ac_prot_enable | accessPermission |
Access permission control enable/disable. | |
bee_endian_swap_enable | endianSwapEn |
Endian swap enable/disable. | |
#define FSL_BEE_DRIVER_VERSION (MAKE_VERSION(2, 0, 2)) |
Version 2.0.2.
Current version: 2.0.2
Change log:
enum bee_aes_mode_t |
enum bee_region_t |
enum bee_ac_prot_enable |
enum bee_security_level |
enum bee_status_flags_t |
void BEE_Init | ( | BEE_Type * | base | ) |
This function performs hardware reset of BEE module. Attributes and keys from software for both regions are cleared.
base | BEE peripheral address. |
void BEE_Deinit | ( | BEE_Type * | base | ) |
This function performs hardware reset of BEE module and disables clocks. Attributes and keys from software for both regions are cleared.
base | BEE peripheral address. |
|
inlinestatic |
This function enables decryption using BEE.
base | BEE peripheral address. |
|
inlinestatic |
This function disables decryption using BEE.
base | BEE peripheral address. |
void BEE_GetDefaultConfig | ( | bee_region_config_t * | config | ) |
Loads default values to the BEE region configuration structure. The default values are as follows:
config | Configuration structure for BEE peripheral. |
void BEE_SetConfig | ( | BEE_Type * | base, |
const bee_region_config_t * | config | ||
) |
This function sets BEE peripheral and BEE region settings accorging to given configuration structure.
base | BEE peripheral address. |
config | Configuration structure for BEE. |
status_t BEE_SetRegionKey | ( | BEE_Type * | base, |
bee_region_t | region, | ||
const uint8_t * | key, | ||
size_t | keySize | ||
) |
This function loads given AES key to BEE register for the given region. The key must be 32-bit aligned and stored in little-endian format.
Please note, that eFuse BEE_KEYx_SEL must be set accordingly to be able to load and use key loaded in BEE registers. Otherwise, key cannot loaded and BEE will use key from OTPMK or SW_GP2.
base | BEE peripheral address. |
region | Selection of the BEE region to be configured. |
key | AES key (in little-endian format). |
keySize | Size of AES key. |
status_t BEE_SetRegionNonce | ( | BEE_Type * | base, |
bee_region_t | region, | ||
const uint8_t * | nonce, | ||
size_t | nonceSize | ||
) |
This function loads given nonce(only AES CTR mode) to BEE register for the given region. The nonce must be 32-bit aligned and stored in little-endian format.
base | BEE peripheral address. |
region | Selection of the BEE region to be configured. |
nonce | AES nonce (in little-endian format). |
nonceSize | Size of AES nonce. |
uint32_t BEE_GetStatusFlags | ( | BEE_Type * | base | ) |
This function returns status of BEE peripheral.
base | BEE peripheral address. |
void BEE_ClearStatusFlags | ( | BEE_Type * | base, |
uint32_t | mask | ||
) |
base | BEE peripheral base address. |
mask | The status flags to clear. This is a logical OR of members of the enumeration bee_status_flags_t |