Functions
aes.c File Reference
#include "inc/hw_types.h"
#include "driverlib/5xx_6xx/debug.h"
#include "driverlib/5xx_6xx/aes.h"
#include "deprecated/CCS/msp430xgeneric.h"

Functions

unsigned char AES_setCipherKey (unsigned int baseAddress, const unsigned char *CipherKey)
unsigned char AES_encryptData (unsigned int baseAddress, const unsigned char *Data, unsigned char *encryptedData)
unsigned char AES_decryptDataUsingEncryptionKey (unsigned int baseAddress, const unsigned char *Data, unsigned char *decryptedData)
unsigned char AES_decryptData (unsigned int baseAddress, const unsigned char *Data, unsigned char *decryptedData)
unsigned char AES_generateFirstRoundKey (unsigned int baseAddress, const unsigned char *CipherKey)
void AES_clearInterruptFlag (unsigned int baseAddress)
unsigned long AES_getInterruptFlagStatus (unsigned int baseAddress)
void AES_enableInterrupt (unsigned int baseAddress)
void AES_disableInterrupt (unsigned int baseAddress)
void AES_reset (unsigned int baseAddress)
unsigned char AES_startEncryptData (unsigned int baseAddress, const unsigned char *Data, unsigned char *encryptedData)
unsigned char AES_startDecryptDataUsingEncryptionKey (unsigned int baseAddress, const unsigned char *Data)
unsigned char AES_startDecryptData (unsigned int baseAddress, const unsigned char *Data)
unsigned char AES_startGenerateFirstRoundKey (unsigned int baseAddress, const unsigned char *CipherKey)
unsigned char AES_getDataOut (unsigned int baseAddress, unsigned char *OutputData)
unsigned char AES_isBusy (unsigned int baseAddress)
void AES_clearErrorFlag (unsigned int baseAddress)
unsigned long AES_getErrorFlagStatus (unsigned int baseAddress)

Function Documentation

unsigned char AES_setCipherKey ( unsigned int  baseAddress,
const unsigned char *  CipherKey 
)

Loads a 128 bit cipher key to AES module.

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

References HWREG, and STATUS_SUCCESS.

unsigned char AES_encryptData ( unsigned int  baseAddress,
const unsigned char *  Data,
unsigned char *  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

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

References HWREG, and STATUS_SUCCESS.

unsigned char AES_decryptDataUsingEncryptionKey ( unsigned int  baseAddress,
const unsigned char *  Data,
unsigned char *  decryptedData 
)

Decryptes 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 unsigned char array with a length of 16 bytes that contains encrypted data to be decrypted.
decryptedDatais a pointer to an unsigned char array with a length of 16 bytes in that the decrypted data will be written.
Returns:
STATUS_SUCCESS

References HWREG, and STATUS_SUCCESS.

unsigned char AES_decryptData ( unsigned int  baseAddress,
const unsigned char *  Data,
unsigned char *  decryptedData 
)

Decryptes a block of data using the AES module. This function requires a pregenerated decryption key. A key can be loaded and pregenerated by using function

Parameters:
AES_generateFirstRoundKey(). The decryption takes 167 MCLK.
baseAddressis the base address of the AES module.
Datais a pointer to an unsigned char array with a length of 16 bytes that contains encrypted data to be decrypted.
decryptedDatais a pointer to an unsigned char array with a length of 16 bytes in that the decrypted data will be written.
Returns:
STATUS_SUCCESS

References HWREG, and STATUS_SUCCESS.

unsigned char AES_generateFirstRoundKey ( unsigned int  baseAddress,
const unsigned char *  CipherKey 
)

Loads and generates first round key required for decryption

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

References HWREG, and STATUS_SUCCESS.

void AES_clearInterruptFlag ( unsigned int  baseAddress)

Clears the AES ready interrupt flag.

Parameters:
baseAddressis the base address of the AES module.

Modified bit is AESRDYIFG of AESACTL0 register.

Returns:
None

References HWREGB.

unsigned long AES_getInterruptFlagStatus ( unsigned int  baseAddress)

Gets the AES ready interrupt flag status.

Parameters:
baseAddressis the base address of the AES module.
Returns:
unsigned long - AES_READY_INTERRUPT or 0x00.

References HWREGB.

void AES_enableInterrupt ( unsigned int  baseAddress)

Enables AES ready interrupt.

Parameters:
baseAddressis the base address of the AES module. Modified bit is AESRDYIE of AESACTL0 register.
Returns:
None.

References HWREGB.

void AES_disableInterrupt ( unsigned int  baseAddress)

Disables AES ready interrupt.

Parameters:
baseAddressis the base address of the AES module.

Modified bit is AESRDYIE of AESACTL0 register.

Returns:
None.

References HWREGB.

void AES_reset ( unsigned int  baseAddress)

Resets AES Module immediately.

Parameters:
baseAddressis the base address of the AES module.

Modified bit is AESSWRST of AESACTL0 register.

Returns:
None.

References HWREGB.

unsigned char AES_startEncryptData ( unsigned int  baseAddress,
const unsigned char *  Data,
unsigned char *  encryptedData 
)

Starts an encryption process on the AES module. This is the non-blocking equivalant of AES_encryptData. The cipher key that is used for decryption should be loaded in advance by using function

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

References HWREG, and STATUS_SUCCESS.

unsigned char AES_startDecryptDataUsingEncryptionKey ( unsigned int  baseAddress,
const unsigned char *  Data 
)

Starts an decryption process on the AES module. This is the non-blocking equivalant 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 unsigned char array with a length of 16 bytes that contains encrypted data to be decrypted.
Returns:
STATUS_SUCCESS

References HWREG, and STATUS_SUCCESS.

unsigned char AES_startDecryptData ( unsigned int  baseAddress,
const unsigned char *  Data 
)

Decryptes a block of data using the AES module. This is the non-blocking equivalant of AES_decryptData. This function requires a pregenerated decryption key. A key can be loaded and pregenerated by using function

Parameters:
AES_generateFirstRoundKey(). The decryption takes 167 MCLK.
baseAddressis the base address of the AES module.
Datais a pointer to an unsigned char array with a length of 16 bytes that contains encrypted data to be decrypted.
Returns:
STATUS_SUCCESS

References HWREG, and STATUS_SUCCESS.

unsigned char AES_startGenerateFirstRoundKey ( unsigned int  baseAddress,
const unsigned char *  CipherKey 
)

Loads and generates first round key required for decryption This is the non-blocking equivalant of AES_generateFirstRoundKey.

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

References HWREG, and STATUS_SUCCESS.

unsigned char AES_getDataOut ( unsigned int  baseAddress,
unsigned char *  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.

Parameters:
baseAddressis the base address of the AES module.
Returns:
is a pointer to an unsigned char 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

References HWREG, STATUS_FAIL, and STATUS_SUCCESS.

unsigned char AES_isBusy ( unsigned int  baseAddress)

Gets the AES module busy status.

Parameters:
baseAddressis the base address of the AES module.
Returns:
unsigned char AES_BUSY or AES_NOT_BUSY

References HWREG.

void AES_clearErrorFlag ( unsigned int  baseAddress)

Clears the AES error flag.

Parameters:
baseAddressis the base address of the AES module.

Modified bit is AESERRFG of AESACTL0 register.

Returns:
None

References HWREGB.

unsigned long AES_getErrorFlagStatus ( unsigned int  baseAddress)

Gets the AES error flag status.

Parameters:
baseAddressis the base address of the AES module.
Returns:
unsigned long - AES_ERROR_OCCURRED or AES_NO_ERROR.

References HWREGB.


Copyright 2012, Texas Instruments Incorporated