CC3200 Peripheral Driver Library User's Guide  1.2.0
DES_Data_Encryption_Standard_api

Functions

void DESConfigSet (uint32_t ui32Base, uint32_t ui32Config)
 
void DESKeySet (uint32_t ui32Base, uint8_t *pui8Key)
 
bool DESIVSet (uint32_t ui32Base, uint8_t *pui8IVdata)
 
void DESDataLengthSet (uint32_t ui32Base, uint32_t ui32Length)
 
bool DESDataReadNonBlocking (uint32_t ui32Base, uint8_t *pui8Dest, uint8_t ui8Length)
 
void DESDataRead (uint32_t ui32Base, uint8_t *pui8Dest, uint8_t ui8Length)
 
bool DESDataWriteNonBlocking (uint32_t ui32Base, uint8_t *pui8Src, uint8_t ui8Length)
 
void DESDataWrite (uint32_t ui32Base, uint8_t *pui8Src, uint8_t ui8Length)
 
bool DESDataProcess (uint32_t ui32Base, uint8_t *pui8Src, uint8_t *pui8Dest, 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

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.
void DESDataLengthSet ( 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 triggersed to start using this context.

Note
Data lengths up to (2^32 - 1) bytes are allowed.
Returns
None.
bool DESDataProcess ( uint32_t  ui32Base,
uint8_t *  pui8Src,
uint8_t *  pui8Dest,
uint32_t  ui32Length 
)

Processes blocks of data through the DES module.

Parameters
ui32Baseis the base address of the DES module.
pui8Srcis a pointer to an array of words that contains the source data for processing.
pui8Destis 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 pui8Src array and processes it using the DES engine. The resulting data is stored in the pui8Dest 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.
void DESDataRead ( uint32_t  ui32Base,
uint8_t *  pui8Dest,
uint8_t  ui8Length 
)

Reads plaintext/ciphertext from data registers with blocking.

Parameters
ui32Baseis the base address of the DES module.
pui8Destis a pointer to an array of bytes.
ui8Lengththe length can be from 1 to 8

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

Returns
None
bool DESDataReadNonBlocking ( uint32_t  ui32Base,
uint8_t *  pui8Dest,
uint8_t  ui8Length 
)

Reads plaintext/ciphertext from data registers without blocking

Parameters
ui32Baseis the base address of the DES module.
pui8Destis a pointer to an array of 2 words.
ui8Lengththe length can be from 1 to 8

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.
void DESDataWrite ( uint32_t  ui32Base,
uint8_t *  pui8Src,
uint8_t  ui8Length 
)

Writes plaintext/ciphertext to data registers without blocking

Parameters
ui32Baseis the base address of the DES module.
pui8Srcis a pointer to an array of bytes.
ui8Lengththe length can be from 1 to 8

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

Returns
None.
bool DESDataWriteNonBlocking ( uint32_t  ui32Base,
uint8_t *  pui8Src,
uint8_t  ui8Length 
)

Writes plaintext/ciphertext to data registers without blocking

Parameters
ui32Baseis the base address of the DES module.
pui8Srcis a pointer to an array of 2 words.
ui8Lengththe length can be from 1 to 8

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.
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.
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.
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.
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.
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.
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.
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.
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.
bool DESIVSet ( uint32_t  ui32Base,
uint8_t *  pui8IVdata 
)

Sets the initialization vector in the DES module.

Parameters
ui32Baseis the base address of the DES module.
pui8IVdatais 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.
void DESKeySet ( uint32_t  ui32Base,
uint8_t *  pui8Key 
)

Sets the key used for DES operations.

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

This function sets the key used for DES operations.

pui8Key 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.