MSP430 DriverLib for MSP430F5xx_6xx Devices  2.91.13.01
aes

Functions

uint8_t AES_setCipherKey (uint16_t baseAddress, const uint8_t *CipherKey)
 Loads a 128 bit cipher key to AES module. More...
 
uint8_t AES_encryptData (uint16_t baseAddress, const uint8_t *Data, uint8_t *encryptedData)
 Encrypts a block of data using the AES module. More...
 
uint8_t AES_decryptData (uint16_t baseAddress, const uint8_t *Data, uint8_t *decryptedData)
 Decrypts a block of data using the AES module. More...
 
uint8_t AES_setDecipherKey (uint16_t baseAddress, const uint8_t *CipherKey)
 Sets the decipher key The API. More...
 
void AES_clearInterrupt (uint16_t baseAddress)
 Clears the AES ready interrupt flag. More...
 
uint32_t AES_getInterruptStatus (uint16_t baseAddress)
 Gets the AES ready interrupt flag status. More...
 
void AES_enableInterrupt (uint16_t baseAddress)
 Enables AES ready interrupt. More...
 
void AES_disableInterrupt (uint16_t baseAddress)
 Disables AES ready interrupt. More...
 
void AES_reset (uint16_t baseAddress)
 Resets AES Module immediately. More...
 
uint8_t AES_startEncryptData (uint16_t baseAddress, const uint8_t *Data, uint8_t *encryptedData)
 Starts an encryption process on the AES module. More...
 
uint8_t AES_startDecryptData (uint16_t baseAddress, const uint8_t *Data)
 Decrypts a block of data using the AES module. More...
 
uint8_t AES_startSetDecipherKey (uint16_t baseAddress, const uint8_t *CipherKey)
 Loads the decipher key. More...
 
uint8_t AES_getDataOut (uint16_t baseAddress, uint8_t *OutputData)
 Reads back the output data from AES module. More...
 
uint8_t AES_isBusy (uint16_t baseAddress)
 Gets the AES module busy status. More...
 
void AES_clearErrorFlag (uint16_t baseAddress)
 Clears the AES error flag. More...
 
uint32_t AES_getErrorFlagStatus (uint16_t baseAddress)
 Gets the AES error flag status. More...
 
uint8_t AES_startDecryptDataUsingEncryptionKey (uint16_t baseAddress, const uint8_t *Data)
 DEPRECATED Starts an decryption process on the AES module. More...
 
uint8_t AES_decryptDataUsingEncryptionKey (uint16_t baseAddress, const uint8_t *Data, uint8_t *decryptedData)
 DEPRECATED Decrypts a block of data using the AES module. More...
 

Detailed Description

Function Documentation

§ AES_clearErrorFlag()

void AES_clearErrorFlag ( uint16_t  baseAddress)

Clears the AES error flag.

Clears the AES error flag that results from a key or data being written while the AES module is busy. Modified bit is AESERRFG of AESACTL0 register.

Parameters
baseAddressis the base address of the AES module.

Modified bits are AESERRFG of AESACTL0 register.

Returns
None

§ AES_clearInterrupt()

void AES_clearInterrupt ( uint16_t  baseAddress)

Clears the AES ready interrupt flag.

This function clears the AES ready interrupt flag. This flag is automatically cleared when AESADOUT is read, or when AESAKEY or AESADIN is written. This function should be used when the flag needs to be reset and it has not been automatically cleared by one of the previous actions.

Parameters
baseAddressis the base address of the AES module.

Modified bits are AESRDYIFG of AESACTL0 register.

Returns
None

§ AES_decryptData()

uint8_t AES_decryptData ( uint16_t  baseAddress,
const uint8_t *  Data,
uint8_t *  decryptedData 
)

Decrypts a block of data using the AES module.

This function requires a pre-generated decryption key. A key can be loaded and pre-generated by using function AES_startSetDecipherKey() or AES_setDecipherKey(). The decryption takes 167 MCLK.

Parameters
baseAddressis the base address of the AES module.
Datais a pointer to an uint8_t array with a length of 16 bytes that contains encrypted data to be decrypted.
decryptedDatais a pointer to an uint8_t array with a length of 16 bytes in that the decrypted data will be written.
Returns
STATUS_SUCCESS

§ AES_decryptDataUsingEncryptionKey()

uint8_t AES_decryptDataUsingEncryptionKey ( uint16_t  baseAddress,
const uint8_t *  Data,
uint8_t *  decryptedData 
)

DEPRECATED Decrypts a block of data using the AES module.

This function can be used to decrypt data by using the same key as used for a previous performed encryption. The decryption takes 214 MCLK.

Parameters
baseAddressis the base address of the AES module.
Datais a pointer to an uint8_t array with a length of 16 bytes that contains encrypted data to be decrypted.
decryptedDatais a pointer to an uint8_t array with a length of 16 bytes in that the decrypted data will be written.
Returns
STATUS_SUCCESS

§ AES_disableInterrupt()

void AES_disableInterrupt ( uint16_t  baseAddress)

Disables AES ready interrupt.

Disables AES ready interrupt. This interrupt is reset by a PUC, but not reset by AES_reset.

Parameters
baseAddressis the base address of the AES module.

Modified bits are AESRDYIE of AESACTL0 register.

Returns
None

§ AES_enableInterrupt()

void AES_enableInterrupt ( uint16_t  baseAddress)

Enables AES ready interrupt.

Enables AES ready interrupt. This interrupt is reset by a PUC, but not reset by AES_reset. Does not clear interrupt flags.

Parameters
baseAddressis the base address of the AES module.

Modified bits are AESRDYIE of AESACTL0 register.

Returns
None

§ AES_encryptData()

uint8_t AES_encryptData ( uint16_t  baseAddress,
const uint8_t *  Data,
uint8_t *  encryptedData 
)

Encrypts a block of data using the AES module.

The cipher key that is used for encryption should be loaded in advance by using function AES_setCipherKey()

Parameters
baseAddressis the base address of the AES module.
Datais a pointer to an uint8_t array with a length of 16 bytes that contains data to be encrypted.
encryptedDatais a pointer to an uint8_t array with a length of 16 bytes in that the encrypted data will be written.
Returns
STATUS_SUCCESS

§ AES_getDataOut()

uint8_t AES_getDataOut ( uint16_t  baseAddress,
uint8_t *  OutputData 
)

Reads back the output data from AES module.

This function is meant to use after an encryption or decryption process that was started and finished by initiating an interrupt by use of the AES_startEncryptData() or AES_startDecryptData() functions.

Parameters
baseAddressis the base address of the AES module.
OutputDatais a pointer to an uint8_t array with a length of 16 bytes in which the output data of the AES module is available. If AES module is busy returns NULL.
Returns
STATUS_SUCCESS if AES is not busy, STATUS_FAIL if it is busy

§ AES_getErrorFlagStatus()

uint32_t AES_getErrorFlagStatus ( uint16_t  baseAddress)

Gets the AES error flag status.

Checks the AES error flag that results from a key or data being written while the AES module is busy. If the flag is set, it needs to be cleared using AES_clearErrorFlag.

Parameters
baseAddressis the base address of the AES module.
Returns
One of the following:
  • AES_ERROR_OCCURRED
  • AES_NO_ERROR
    indicating if AESAKEY or AESADIN were written while an AES operation was in progress

§ AES_getInterruptStatus()

uint32_t AES_getInterruptStatus ( uint16_t  baseAddress)

Gets the AES ready interrupt flag status.

This function checks the AES ready interrupt flag. This flag is automatically cleared when AESADOUT is read, or when AESAKEY or AESADIN is written. This function can be used to confirm that this has been done.

Parameters
baseAddressis the base address of the AES module.
Returns
uint32_t - AES_READY_INTERRUPT or 0x00.

§ AES_isBusy()

uint8_t AES_isBusy ( uint16_t  baseAddress)

Gets the AES module busy status.

Gets the AES module busy status. If a key or data are written while the AES module is busy, an error flag will be thrown.

Parameters
baseAddressis the base address of the AES module.
Returns
One of the following:
  • AES_BUSY
  • AES_NOT_BUSY
    indicating if encryption/decryption/key generation is taking place

§ AES_reset()

void AES_reset ( uint16_t  baseAddress)

Resets AES Module immediately.

This function performs a software reset on the AES Module, note that this does not affect the AES ready interrupt.

Parameters
baseAddressis the base address of the AES module.

Modified bits are AESSWRST of AESACTL0 register.

Returns
None

§ AES_setCipherKey()

uint8_t AES_setCipherKey ( uint16_t  baseAddress,
const uint8_t *  CipherKey 
)

Loads a 128 bit cipher key to AES module.

This function loads a 128 bit cipher key to AES module.

Parameters
baseAddressis the base address of the AES module.
CipherKeyis a pointer to an uint8_t array with a length of 16 bytes that contains a 128 bit cipher key.
Returns
STATUS_SUCCESS

§ AES_setDecipherKey()

uint8_t AES_setDecipherKey ( uint16_t  baseAddress,
const uint8_t *  CipherKey 
)

Sets the decipher key The API.

The API AES_startSetDecipherKey() or AES_setDecipherKey() must be invoked before invoking AES_setDecipherKey().

Parameters
baseAddressis the base address of the AES module.
CipherKeyis a pointer to an uint8_t array with a length of 16 bytes that contains the initial AES key.
Returns
STATUS_SUCCESS

§ AES_startDecryptData()

uint8_t AES_startDecryptData ( uint16_t  baseAddress,
const uint8_t *  Data 
)

Decrypts a block of data using the AES module.

This is the non-blocking equivalent of AES_decryptData(). This function requires a pre-generated decryption key. A key can be loaded and pre- generated by using function AES_setDecipherKey() or AES_startSetDecipherKey(). The decryption takes 167 MCLK. It is recommended to use interrupt to check for procedure completion then using AES_getDataOut() API to retrieve the decrypted data.

Parameters
baseAddressis the base address of the AES module.
Datais a pointer to an uint8_t array with a length of 16 bytes that contains encrypted data to be decrypted.
Returns
STATUS_SUCCESS

§ AES_startDecryptDataUsingEncryptionKey()

uint8_t AES_startDecryptDataUsingEncryptionKey ( uint16_t  baseAddress,
const uint8_t *  Data 
)

DEPRECATED Starts an decryption process on the AES module.

This is the non-blocking equivalent of AES_decryptDataUsingEncryptionKey(). This function can be used to decrypt data by using the same key as used for a previous performed encryption. The decryption takes 214 MCLK.

Parameters
baseAddressis the base address of the AES module.
Datais a pointer to an uint8_t array with a length of 16 bytes that contains encrypted data to be decrypted.
Returns
STATUS_SUCCESS

§ AES_startEncryptData()

uint8_t AES_startEncryptData ( uint16_t  baseAddress,
const uint8_t *  Data,
uint8_t *  encryptedData 
)

Starts an encryption process on the AES module.

This is the non-blocking equivalent of AES_encryptData(). The cipher key that is used for decryption should be loaded in advance by using function AES_setCipherKey(). It is recommended to use interrupt to check for procedure completion then using AES_getDataOut() API to retrieve the encrypted data.

Parameters
baseAddressis the base address of the AES module.
Datais a pointer to an uint8_t array with a length of 16 bytes that contains data to be encrypted.
encryptedDatais a pointer to an uint8_t array with a length of 16 bytes in that the encrypted data will be written.
Returns
STATUS_SUCCESS

§ AES_startSetDecipherKey()

uint8_t AES_startSetDecipherKey ( uint16_t  baseAddress,
const uint8_t *  CipherKey 
)

Loads the decipher key.

This is the non-blocking equivalent of AES_setDecipherKey(). The API AES_startSetDecipherKey() or AES_setDecipherKey() must be invoked before invoking AES_startSetDecipherKey().

Parameters
baseAddressis the base address of the AES module.
CipherKeyis a pointer to an uint8_t array with a length of 16 bytes that contains the initial AES key.
Returns
STATUS_SUCCESS

Copyright 2020, Texas Instruments Incorporated