MCUXpresso SDK API Reference Manual  Rev. 0
NXP Semiconductors
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
OTFAD: On The Fly AES-128 Decryption Driver

Overview

The MCUXpresso SDK provides a peripheral driver for On The Fly AES-128 Decryption (OTFAD) module of MCUXpresso SDK devices.

This example code shows how to decrypt ciphertext in external memory using the OTFAD driver.

Refer to the driver examples codes located at <SDK_ROOT>/boards/<BOARD>/driver_examples/otfad

Data Structures

struct  otfad_encryption_config_t
 OTFAD encryption configuration structure. More...
 
struct  otfad_config_t
 OTFAD configuration structure. More...
 

Enumerations

enum  {
  kStatus_OTFAD_ResRegAccessMode = MAKE_STATUS(kStatusGroup_OTFAD, 0),
  kStatus_OTFAD_AddressError = MAKE_STATUS(kStatusGroup_OTFAD, 1),
  kStatus_OTFAD_RegionOverlap,
  kStatus_OTFAD_RegionMiss
}
 Status codes for the OTFAD driver. More...
 
enum  {
  kOTFAD_Context_0 = 0U,
  kOTFAD_Context_1 = 1U,
  kOTFAD_Context_2 = 2U,
  kOTFAD_Context_3 = 3U
}
 OTFAD context type. More...
 
enum  {
  kOTFAD_NRM = 0x00U,
  kOTFAD_SVM = 0x02U,
  kOTFAD_LDM = 0x03U
}
 OTFAD operate mode. More...
 

Driver version

#define FSL_OTFAD_DRIVER_VERSION   (MAKE_VERSION(2U, 1U, 1U))
 Driver version 2.1.1. More...
 

Initialization and deinitialization

void OTFAD_GetDefaultConfig (otfad_config_t *config)
 OTFAD module initialization function. More...
 
void OTFAD_Init (OTFAD_Type *base, const otfad_config_t *config)
 OTFAD module initialization function. More...
 
void OTFAD_Deinit (OTFAD_Type *base)
 Deinitializes the OTFAD.
 

Status

static uint32_t OTFAD_GetOperateMode (OTFAD_Type *base)
 OTFAD module get operate mode. More...
 
static uint32_t OTFAD_GetStatus (OTFAD_Type *base)
 OTFAD module get status. More...
 

functional

status_t OTFAD_SetEncryptionConfig (OTFAD_Type *base, const otfad_encryption_config_t *config)
 OTFAD module set encryption configuration. More...
 
status_t OTFAD_GetEncryptionConfig (OTFAD_Type *base, otfad_encryption_config_t *config)
 OTFAD module get encryption configuration. More...
 
status_t OTFAD_HitDetermination (OTFAD_Type *base, uint32_t address, uint8_t *contextIndex)
 OTFAD module do hit determination. More...
 

Data Structure Documentation

struct otfad_encryption_config_t

Data Fields

bool valid
 The context is valid or not.
 
bool AESdecryption
 AES decryption enable.
 
uint8_t readOnly
 read write attribute for the entire set of context registers
 
uint8_t contextIndex
 OTFAD context index.
 
uint32_t startAddr
 Start address.
 
uint32_t endAddr
 End address.
 
uint32_t key [4]
 Encryption key.
 
uint32_t counter [2]
 Encryption counter.
 
struct otfad_config_t

Data Fields

bool enableIntRequest
 Interrupt request enable.
 
bool forceError
 Forces the OTFAD's key blob error flag (SR[KBERR]) to be asserted.
 
bool forceSVM
 Force entry into SVM after a write.
 
bool forceLDM
 Force entry into LDM after a write.
 
bool keyBlobScramble
 Key blob KEK scrambling.
 
bool keyBlobProcess
 Key blob processing.
 
bool startKeyBlobProcessing
 key blob processing is initiated
 
bool restrictedRegAccess
 Restricted register access enable.
 
bool enableOTFAD
 OTFAD has decryption enabled.
 

Macro Definition Documentation

#define FSL_OTFAD_DRIVER_VERSION   (MAKE_VERSION(2U, 1U, 1U))

Enumeration Type Documentation

anonymous enum
Enumerator
kStatus_OTFAD_ResRegAccessMode 

Restricted register mode.

kStatus_OTFAD_AddressError 

End address less than start address.

kStatus_OTFAD_RegionOverlap 

the OTFAD does not support any form of memory region overlap, for system accesses that hit in multiple contexts or no contexts, the fetched data is simply bypassed

kStatus_OTFAD_RegionMiss 

For accesses that hit in a single context, but not the selected one.

anonymous enum
Enumerator
kOTFAD_Context_0 

context 0

kOTFAD_Context_1 

context 1

kOTFAD_Context_2 

context 2

kOTFAD_Context_3 

context 3

anonymous enum
Enumerator
kOTFAD_NRM 

Normal Mode.

kOTFAD_SVM 

Security Violation Mode.

kOTFAD_LDM 

Logically Disabled Mode.

Function Documentation

void OTFAD_GetDefaultConfig ( otfad_config_t config)
Parameters
configOTFAD configuration.
void OTFAD_Init ( OTFAD_Type *  base,
const otfad_config_t config 
)
Parameters
baseOTFAD base address.
configOTFAD configuration.
static uint32_t OTFAD_GetOperateMode ( OTFAD_Type *  base)
inlinestatic
Parameters
baseOTFAD base address.
static uint32_t OTFAD_GetStatus ( OTFAD_Type *  base)
inlinestatic
Parameters
baseOTFAD base address.
status_t OTFAD_SetEncryptionConfig ( OTFAD_Type *  base,
const otfad_encryption_config_t config 
)
Parameters
baseOTFAD base address.
configencryption configuration.

Note: if enable keyblob process, the first 256 bytes external memory is use for keyblob data, so this region shouldn't be in OTFAD region.

status_t OTFAD_GetEncryptionConfig ( OTFAD_Type *  base,
otfad_encryption_config_t config 
)
Parameters
baseOTFAD base address.
configencryption configuration.

Note: if enable keyblob process, the first 256 bytes external memory is use for keyblob data, so this region shouldn't be in OTFAD region.

status_t OTFAD_HitDetermination ( OTFAD_Type *  base,
uint32_t  address,
uint8_t *  contextIndex 
)
Parameters
baseOTFAD base address.
addressthe physical address space assigned to the QuadSPI(FlexSPI) module.
contextIndexhitted context region index.
Returns
status, such as kStatus_Success or kStatus_OTFAD_ResRegAccessMode.