Defines | Functions
aes256.h File Reference

Go to the source code of this file.

Defines

#define __MSP430_HAS_AES256__
#define AES256_READY_INTERRUPT   AESRDYIE
#define AES256_ERROR_OCCURRED   AESERRFG
#define AES256_NO_ERROR   0x00
#define AES_getEncryptedData   AES_getDataOut
#define AES_getDecryptedData   AES_getDataOut
#define AES256_BUSY   AESBUSY
#define AES256_NOT_BUSY   0x00
#define Key_128BIT   128
#define Key_192BIT   192
#define Key_256BIT   256
#define AES_INTERRUPT_ENABLE   AESRDYI

Functions

unsigned char AES256_setCipherKey (unsigned int baseAddress, const unsigned char *CipherKey, unsigned int KeyLength)
unsigned char AES256_encryptData (unsigned int baseAddress, const unsigned char *Data, unsigned char *encryptedData)
unsigned char AES256_decryptDataUsingEncryptionKey (unsigned int baseAddress, const unsigned char *Data, unsigned char *decryptedData)
unsigned char AES256_decryptData (unsigned int baseAddress, const unsigned char *Data, unsigned char *decryptedData)
unsigned char AES256_generateFirstRoundKey (unsigned int baseAddress, const unsigned char *CipherKey)
void AES256_clearInterruptFlag (unsigned int baseAddress)
unsigned long AES256_getInterruptFlagStatus (unsigned int baseAddress)
void AES256_enableInterrupt (unsigned int baseAddress)
void AES256_disableInterrupt (unsigned int baseAddress)
void AES256_reset (unsigned int baseAddress)
unsigned char AES256_startEncryptData (unsigned int baseAddress, const unsigned char *Data, unsigned char *encryptedData)
unsigned char AES256_startDecryptDataUsingEncryptionKey (unsigned int baseAddress, const unsigned char *Data)
unsigned char AES256_startDecryptData (unsigned int baseAddress, const unsigned char *Data)
unsigned char AES256_startGenerateFirstRoundKey (unsigned int baseAddress, const unsigned char *CipherKey)
unsigned char AES256_getDataOut (unsigned int baseAddress, unsigned char *OutputData)
unsigned char AES256_isBusy (unsigned int baseAddress)
void AES256_clearErrorFlag (unsigned int baseAddress)
unsigned long AES256_getErrorFlagStatus (unsigned int baseAddress)

Define Documentation

#define __MSP430_HAS_AES256__
#define AES256_READY_INTERRUPT   AESRDYIE
#define AES256_ERROR_OCCURRED   AESERRFG
#define AES256_NO_ERROR   0x00
#define AES_getEncryptedData   AES_getDataOut
#define AES_getDecryptedData   AES_getDataOut
#define AES256_BUSY   AESBUSY
#define AES256_NOT_BUSY   0x00
#define Key_128BIT   128

Referenced by AES256_setCipherKey().

#define Key_192BIT   192

Referenced by AES256_setCipherKey().

#define Key_256BIT   256

Referenced by AES256_setCipherKey().

#define AES_INTERRUPT_ENABLE   AESRDYI

Function Documentation

unsigned char AES256_setCipherKey ( unsigned int  baseAddress,
const unsigned char *  CipherKey,
unsigned int  KeyLength 
)

Loads a 128, 192 or 256 bit cipher key to AES256 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, Key_128BIT, Key_192BIT, Key_256BIT, STATUS_FAIL, and STATUS_SUCCESS.

unsigned char AES256_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:
AES256_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 AES256_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 AES256_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:
AES256_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 AES256_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 AES256_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 AES256_getInterruptFlagStatus ( unsigned int  baseAddress)

Gets the AES ready interrupt flag status.

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

References HWREGB.

void AES256_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 AES256_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 AES256_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 AES256_startEncryptData ( unsigned int  baseAddress,
const unsigned char *  Data,
unsigned char *  encryptedData 
)

Starts an encryption process on the AES module. The cipher key that is used for decryption should be loaded in advance by using function

Parameters:
AES256_setCipherKey().This is the non-blocking equivalant of AES256_encryptData.
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 AES256_startDecryptDataUsingEncryptionKey ( unsigned int  baseAddress,
const unsigned char *  Data 
)

Starts an decryption process on the AES module. This is the non-blocking equivalant of AES256_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 AES256_startDecryptData ( unsigned int  baseAddress,
const unsigned char *  Data 
)

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

Parameters:
AES256_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 AES256_startGenerateFirstRoundKey ( unsigned int  baseAddress,
const unsigned char *  CipherKey 
)

Loads and generates first round key required for decryption This is the non-blocking equivalant of AES256_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 AES256_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 AES256_isBusy ( unsigned int  baseAddress)

Gets the AES module busy status.

Parameters:
baseAddressis the base address of the AES module.
Returns:
unsigned char AES256_BUSY or AES256_NOT_BUSY

References HWREG.

void AES256_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 AES256_getErrorFlagStatus ( unsigned int  baseAddress)

Gets the AES error flag status.

Parameters:
baseAddressis the base address of the AES module.
Returns:
unsigned long - AES256_ERROR_OCCURRED or AES256_NO_ERROR.

References HWREGB.


Copyright 2012, Texas Instruments Incorporated