Functions
Des_api

Functions

void DESReset (uint32_t ui32Base)
 
void DESConfigSet (uint32_t ui32Base, uint32_t ui32Config)
 
void DESKeySet (uint32_t ui32Base, uint32_t *pui32Key)
 
bool DESIVSet (uint32_t ui32Base, uint32_t *pui32IVdata)
 
void DESLengthSet (uint32_t ui32Base, uint32_t ui32Length)
 
bool DESDataReadNonBlocking (uint32_t ui32Base, uint32_t *pui32Dest)
 
void DESDataRead (uint32_t ui32Base, uint32_t *pui32Dest)
 
bool DESDataWriteNonBlocking (uint32_t ui32Base, uint32_t *pui32Src)
 
void DESDataWrite (uint32_t ui32Base, uint32_t *pui32Src)
 
bool DESDataProcess (uint32_t ui32Base, uint32_t *pui32Src, uint32_t *pui32Dest, uint32_t ui32Length)
 
uint32_t DESIntStatus (uint32_t ui32Base, bool bMasked)
 
void DESIntEnable (uint32_t ui32Base, uint32_t ui32IntFlags)
 
void DESIntDisable (uint32_t ui32Base, uint32_t ui32IntFlags)
 
void DESIntClear (uint32_t ui32Base, uint32_t ui32IntFlags)
 
void DESIntRegister (uint32_t ui32Base, void(*pfnHandler)(void))
 
void DESIntUnregister (uint32_t ui32Base)
 
void DESDMAEnable (uint32_t ui32Base, uint32_t ui32Flags)
 
void DESDMADisable (uint32_t ui32Base, uint32_t ui32Flags)
 

Detailed Description

Function Documentation

§ DESReset()

void DESReset ( uint32_t  ui32Base)

Resets the DES Module.

Parameters
ui32Baseis the base address of the DES module.

This function performs a soft-reset sequence of the DES module.

Returns
None.

References ASSERT, DES_O_SYSCONFIG, DES_O_SYSSTATUS, DES_SYSCONFIG_SOFTRESET, DES_SYSSTATUS_RESETDONE, and HWREG.

§ DESConfigSet()

void DESConfigSet ( uint32_t  ui32Base,
uint32_t  ui32Config 
)

Configures the DES module for operation.

Parameters
ui32Baseis the base address of the DES module.
ui32Configis the configuration of the DES module.

This function configures the DES module for operation.

The ui32Config parameter is a bit-wise OR of a number of configuration flags. The valid flags are grouped below based on their function.

The direction of the operation is specified with one of the following two flags. Only one is permitted.

  • DES_CFG_DIR_ENCRYPT - Encryption
  • DES_CFG_DIR_DECRYPT - Decryption

The operational mode of the DES engine is specified with one of the following flags. Only one is permitted.

  • DES_CFG_MODE_ECB - Electronic Codebook Mode
  • DES_CFG_MODE_CBC - Cipher-Block Chaining Mode
  • DES_CFG_MODE_CFB - Cipher Feedback Mode

The selection of single DES or triple DES is specified with one of the following two flags. Only one is permitted.

  • DES_CFG_SINGLE - Single DES
  • DES_CFG_TRIPLE - Triple DES
Returns
None.

References ASSERT, DES_CTRL_CONTEXT, DES_O_CTRL, and HWREG.

§ DESKeySet()

void DESKeySet ( uint32_t  ui32Base,
uint32_t *  pui32Key 
)

Sets the key used for DES operations.

Parameters
ui32Baseis the base address of the DES module.
pui32Keyis a pointer to an array that holds the key

This function sets the key used for DES operations.

pui32Key should be 64 bits long (2 words) if single DES is being used or 192 bits (6 words) if triple DES is being used.

Returns
None.

References ASSERT, DES_CFG_TRIPLE, DES_O_CTRL, DES_O_KEY1_H, DES_O_KEY1_L, DES_O_KEY2_H, DES_O_KEY2_L, DES_O_KEY3_H, DES_O_KEY3_L, and HWREG.

§ DESIVSet()

bool DESIVSet ( uint32_t  ui32Base,
uint32_t *  pui32IVdata 
)

Sets the initialization vector in the DES module.

Parameters
ui32Baseis the base address of the DES module.
pui32IVdatais a pointer to an array of 64 bits (2 words) of data to be written into the initialization vectors registers.

This function sets the initialization vector in the DES module. It returns true if the registers were successfully written. If the context registers cannot be written at the time the function was called, then false is returned.

Returns
True or false.

References ASSERT, DES_CTRL_CONTEXT, DES_O_CTRL, DES_O_IV_H, DES_O_IV_L, and HWREG.

§ DESLengthSet()

void DESLengthSet ( uint32_t  ui32Base,
uint32_t  ui32Length 
)

Sets the crytographic data length in the DES module.

Parameters
ui32Baseis the base address of the DES module.
ui32Lengthis the length of the data in bytes.

This function writes the cryptographic data length into the DES module. When this register is written, the engine is triggered to start using this context.

Note
Data lengths up to (2^32 - 1) bytes are allowed.
Returns
None.

References ASSERT, DES_O_LENGTH, and HWREG.

§ DESDataReadNonBlocking()

bool DESDataReadNonBlocking ( uint32_t  ui32Base,
uint32_t *  pui32Dest 
)

Reads plaintext/ciphertext from data registers without blocking

Parameters
ui32Baseis the base address of the DES module.
pui32Destis a pointer to an array of 2 words.

This function returns true if the data was ready when the function was called. If the data was not ready, false is returned.

Returns
True or false.

References ASSERT, DES_CTRL_OUTPUT_READY, DES_O_CTRL, DES_O_DATA_H, DES_O_DATA_L, and HWREG.

Referenced by DESDataProcess().

§ DESDataRead()

void DESDataRead ( uint32_t  ui32Base,
uint32_t *  pui32Dest 
)

Reads plaintext/ciphertext from data registers with blocking.

Parameters
ui32Baseis the base address of the DES module.
pui32Destis a pointer to an array of bytes.

This function waits until the DES module is finished and encrypted or decrypted data is ready. The output data is then stored in the pui32Dest array.

Returns
None

References ASSERT, DES_CTRL_OUTPUT_READY, DES_O_CTRL, DES_O_DATA_H, DES_O_DATA_L, and HWREG.

§ DESDataWriteNonBlocking()

bool DESDataWriteNonBlocking ( uint32_t  ui32Base,
uint32_t *  pui32Src 
)

Writes plaintext/ciphertext to data registers without blocking

Parameters
ui32Baseis the base address of the DES module.
pui32Srcis a pointer to an array of 2 words.

This function returns false if the DES module is not ready to accept data. It returns true if the data was written successfully.

Returns
true or false.

References ASSERT, DES_CTRL_INPUT_READY, DES_O_CTRL, DES_O_DATA_H, DES_O_DATA_L, and HWREG.

Referenced by DESDataProcess().

§ DESDataWrite()

void DESDataWrite ( uint32_t  ui32Base,
uint32_t *  pui32Src 
)

Writes plaintext/ciphertext to data registers without blocking

Parameters
ui32Baseis the base address of the DES module.
pui32Srcis a pointer to an array of bytes.

This function waits until the DES module is ready before writing the data contained in the pui32Src array.

Returns
None.

References ASSERT, DES_CTRL_INPUT_READY, DES_O_CTRL, DES_O_DATA_H, DES_O_DATA_L, and HWREG.

§ DESDataProcess()

bool DESDataProcess ( uint32_t  ui32Base,
uint32_t *  pui32Src,
uint32_t *  pui32Dest,
uint32_t  ui32Length 
)

Processes blocks of data through the DES module.

Parameters
ui32Baseis the base address of the DES module.
pui32Srcis a pointer to an array of words that contains the source data for processing.
pui32Destis a pointer to an array of words consisting of the processed data.
ui32Lengthis the length of the cryptographic data in bytes. It must be a multiple of eight.

This function takes the data contained in the pui32Src array and processes it using the DES engine. The resulting data is stored in the pui32Dest array. The function blocks until all of the data has been processed. If processing is successful, the function returns true.

Note
This functions assumes that the DES module has been configured, and initialization values and keys have been written.
Returns
true or false.

References ASSERT, DES_CTRL_INPUT_READY, DES_CTRL_OUTPUT_READY, DES_O_CTRL, DES_O_LENGTH, DESDataReadNonBlocking(), DESDataWriteNonBlocking(), and HWREG.

§ DESIntStatus()

uint32_t DESIntStatus ( uint32_t  ui32Base,
bool  bMasked 
)

Returns the current interrupt status of the DES module.

Parameters
ui32Baseis the base address of the DES module.
bMaskedis false if the raw interrupt status is required and true if the masked interrupt status is required.

This function gets the current interrupt status of the DES module. The value returned is a logical OR of the following values:

  • DES_INT_CONTEXT_IN - Context interrupt
  • DES_INT_DATA_IN - Data input interrupt
  • DES_INT_DATA_OUT_INT - Data output interrupt
  • DES_INT_DMA_CONTEXT_IN - Context DMA done interrupt
  • DES_INT_DMA_DATA_IN - Data input DMA done interrupt
  • DES_INT_DMA_DATA_OUT - Data output DMA done interrupt
Returns
A bit mask of the current interrupt status.

References ASSERT, DES_O_DMAMIS, DES_O_DMARIS, DES_O_IRQENABLE, DES_O_IRQSTATUS, and HWREG.

§ DESIntEnable()

void DESIntEnable ( uint32_t  ui32Base,
uint32_t  ui32IntFlags 
)

Enables interrupts in the DES module.

Parameters
ui32Baseis the base address of the DES module.
ui32IntFlagsis a bit mask of the interrupts to be enabled.

ui32IntFlags should be a logical OR of one or more of the following values:

  • DES_INT_CONTEXT_IN - Context interrupt
  • DES_INT_DATA_IN - Data input interrupt
  • DES_INT_DATA_OUT - Data output interrupt
  • DES_INT_DMA_CONTEXT_IN - Context DMA done interrupt
  • DES_INT_DMA_DATA_IN - Data input DMA done interrupt
  • DES_INT_DMA_DATA_OUT - Data output DMA done interrupt
Returns
None.

References ASSERT, DES_INT_CONTEXT_IN, DES_INT_DATA_IN, DES_INT_DATA_OUT, DES_INT_DMA_CONTEXT_IN, DES_INT_DMA_DATA_IN, DES_INT_DMA_DATA_OUT, DES_O_DMAIM, DES_O_IRQENABLE, and HWREG.

§ DESIntDisable()

void DESIntDisable ( uint32_t  ui32Base,
uint32_t  ui32IntFlags 
)

Disables interrupts in the DES module.

Parameters
ui32Baseis the base address of the DES module.
ui32IntFlagsis a bit mask of the interrupts to be disabled.

This function disables interrupt sources in the DES module. ui32IntFlags should be a logical OR of one or more of the following values:

  • DES_INT_CONTEXT_IN - Context interrupt
  • DES_INT_DATA_IN - Data input interrupt
  • DES_INT_DATA_OUT - Data output interrupt
  • DES_INT_DMA_CONTEXT_IN - Context DMA done interrupt
  • DES_INT_DMA_DATA_IN - Data input DMA done interrupt
  • DES_INT_DMA_DATA_OUT - Data output DMA done interrupt
Returns
None.

References ASSERT, DES_INT_CONTEXT_IN, DES_INT_DATA_IN, DES_INT_DATA_OUT, DES_INT_DMA_CONTEXT_IN, DES_INT_DMA_DATA_IN, DES_INT_DMA_DATA_OUT, DES_O_DMAIM, DES_O_IRQENABLE, and HWREG.

§ DESIntClear()

void DESIntClear ( uint32_t  ui32Base,
uint32_t  ui32IntFlags 
)

Clears interrupts in the DES module.

Parameters
ui32Baseis the base address of the DES module.
ui32IntFlagsis a bit mask of the interrupts to be disabled.

This function disables interrupt sources in the DES module. ui32IntFlags should be a logical OR of one or more of the following values:

  • DES_INT_DMA_CONTEXT_IN - Context interrupt
  • DES_INT_DMA_DATA_IN - Data input interrupt
  • DES_INT_DMA_DATA_OUT - Data output interrupt
Note
The DMA done interrupts are the only interrupts that can be cleared. The remaining interrupts can be disabled instead using DESIntDisable().
Returns
None.

References ASSERT, DES_INT_DMA_CONTEXT_IN, DES_INT_DMA_DATA_IN, DES_INT_DMA_DATA_OUT, DES_O_DMAIC, and HWREG.

§ DESIntRegister()

void DESIntRegister ( uint32_t  ui32Base,
void(*)(void)  pfnHandler 
)

Registers an interrupt handler for the DES module.

Parameters
ui32Baseis the base address of the DES module.
pfnHandleris a pointer to the function to be called when the enabled DES interrupts occur.

This function registers the interrupt handler in the interrupt vector table, and enables DES interrupts on the interrupt controller; specific DES interrupt sources must be enabled using DESIntEnable(). The interrupt handler being registered must clear the source of the interrupt using DESIntClear().

If the application is using a static interrupt vector table stored in flash, then it is not necessary to register the interrupt handler this way. Instead, IntEnable() should be used to enable DES interrupts on the interrupt controller.

See also
IntRegister() for important information about registering interrupt handlers.
Returns
None.

References ASSERT, INT_DES0, IntEnable(), and IntRegister().

§ DESIntUnregister()

void DESIntUnregister ( uint32_t  ui32Base)

Unregisters an interrupt handler for the DES module.

Parameters
ui32Baseis the base address of the DES module.

This function unregisters the previously registered interrupt handler and disables the interrupt in the interrupt controller.

See also
IntRegister() for important information about registering interrupt handlers.
Returns
None.

References ASSERT, INT_DES0, IntDisable(), and IntUnregister().

§ DESDMAEnable()

void DESDMAEnable ( uint32_t  ui32Base,
uint32_t  ui32Flags 
)

Enables DMA request sources in the DES module.

Parameters
ui32Baseis the base address of the DES module.
ui32Flagsis a bit mask of the DMA requests to be enabled.

This function enables DMA request sources in the DES module. The ui32Flags parameter should be the logical OR of any of the following:

  • DES_DMA_CONTEXT_IN - Context In
  • DES_DMA_DATA_OUT - Data Out
  • DES_DMA_DATA_IN - Data In
Returns
None.

References ASSERT, DES_DMA_CONTEXT_IN, DES_DMA_DATA_IN, DES_DMA_DATA_OUT, DES_O_SYSCONFIG, and HWREG.

§ DESDMADisable()

void DESDMADisable ( uint32_t  ui32Base,
uint32_t  ui32Flags 
)

Disables DMA request sources in the DES module.

Parameters
ui32Baseis the base address of the DES module.
ui32Flagsis a bit mask of the DMA requests to be disabled.

This function disables DMA request sources in the DES module. The ui32Flags parameter should be the logical OR of any of the following:

  • DES_DMA_CONTEXT_IN - Context In
  • DES_DMA_DATA_OUT - Data Out
  • DES_DMA_DATA_IN - Data In
Returns
None.

References ASSERT, DES_DMA_CONTEXT_IN, DES_DMA_DATA_IN, DES_DMA_DATA_OUT, DES_O_SYSCONFIG, and HWREG.

Copyright 2017, Texas Instruments Incorporated