Module to interact with the Advanced Encryption Standard 256 (AES256) hardware accelerator. More...
Macros | |
#define | AES256_CMSIS(x) ((AES256_Type *) x) |
#define | Key_128BIT 128 |
#define | Key_192BIT 192 |
#define | Key_256BIT 256 |
#define | AES256_KEYLENGTH_128BIT 128 |
#define | AES256_KEYLENGTH_192BIT 192 |
#define | AES256_KEYLENGTH_256BIT 256 |
#define | AES256_ERROR_OCCURRED AES256_CTL0_ERRFG |
#define | AES256_NO_ERROR 0x00 |
#define | AES256_BUSY AES256_STAT_BUSY |
#define | AES256_NOT_BUSY 0x00 |
#define | AES256_READY_INTERRUPT 0x01 |
#define | AES256_NOTREADY_INTERRUPT 0x00 |
Functions | |
bool | AES256_setCipherKey (uint32_t moduleInstance, const uint8_t *cipherKey, uint_fast16_t keyLength) |
Loads a 128, 192 or 256 bit cipher key to AES256 module. More... | |
void | AES256_encryptData (uint32_t moduleInstance, const uint8_t *data, uint8_t *encryptedData) |
Encrypts a block of data using the AES256 module. More... | |
void | AES256_decryptData (uint32_t moduleInstance, const uint8_t *data, uint8_t *decryptedData) |
Decrypts a block of data using the AES256 module. More... | |
bool | AES256_setDecipherKey (uint32_t moduleInstance, const uint8_t *cipherKey, uint_fast16_t keyLength) |
Sets the decipher key. More... | |
void | AES256_clearInterruptFlag (uint32_t moduleInstance) |
Clears the AES256 ready interrupt flag. More... | |
uint32_t | AES256_getInterruptFlagStatus (uint32_t moduleInstance) |
Gets the AES256 ready interrupt flag status. More... | |
void | AES256_enableInterrupt (uint32_t moduleInstance) |
Enables AES256 ready interrupt. More... | |
void | AES256_disableInterrupt (uint32_t moduleInstance) |
Disables AES256 ready interrupt. More... | |
void | AES256_reset (uint32_t moduleInstance) |
Resets AES256 Module immediately. More... | |
void | AES256_startEncryptData (uint32_t moduleInstance, const uint8_t *data) |
Starts an encryption process on the AES256 module. More... | |
void | AES256_startDecryptData (uint32_t moduleInstance, const uint8_t *data) |
Decypts a block of data using the AES256 module. More... | |
bool | AES256_startSetDecipherKey (uint32_t moduleInstance, const uint8_t *cipherKey, uint_fast16_t keyLength) |
Sets the decipher key. More... | |
bool | AES256_getDataOut (uint32_t moduleInstance, uint8_t *outputData) |
Reads back the output data from AES256 module. More... | |
bool | AES256_isBusy (uint32_t moduleInstance) |
Gets the AES256 module busy status. More... | |
void | AES256_clearErrorFlag (uint32_t moduleInstance) |
Clears the AES256 error flag. More... | |
uint32_t | AES256_getErrorFlagStatus (uint32_t moduleInstance) |
Gets the AES256 error flag status. More... | |
void | AES256_registerInterrupt (uint32_t moduleInstance, void(*intHandler)(void)) |
void | AES256_unregisterInterrupt (uint32_t moduleInstance) |
uint32_t | AES256_getInterruptStatus (uint32_t moduleInstance) |
Module to interact with the Advanced Encryption Standard 256 (AES256) hardware accelerator.
The AES256256 accelerator module performs encryption and decryption of 128-bit data with 128-/192-/256-bit keys according to the advanced encryption standard (AES256) (FIPS PUB 197) in hardware.
AES256 encryption
AES256 decryption:
#define AES256_CMSIS | ( | x | ) | ((AES256_Type *) x) |
Referenced by AES256_clearErrorFlag(), AES256_clearInterruptFlag(), AES256_decryptData(), AES256_disableInterrupt(), AES256_enableInterrupt(), AES256_encryptData(), AES256_getDataOut(), AES256_getErrorFlagStatus(), AES256_getInterruptFlagStatus(), AES256_isBusy(), AES256_reset(), AES256_setCipherKey(), AES256_setDecipherKey(), AES256_startDecryptData(), AES256_startEncryptData(), and AES256_startSetDecipherKey().
#define Key_128BIT 128 |
#define Key_192BIT 192 |
#define Key_256BIT 256 |
#define AES256_KEYLENGTH_128BIT 128 |
Referenced by AES256_setCipherKey(), AES256_setDecipherKey(), and AES256_startSetDecipherKey().
#define AES256_KEYLENGTH_192BIT 192 |
Referenced by AES256_setCipherKey(), AES256_setDecipherKey(), and AES256_startSetDecipherKey().
#define AES256_KEYLENGTH_256BIT 256 |
Referenced by AES256_setCipherKey(), AES256_setDecipherKey(), and AES256_startSetDecipherKey().
#define AES256_ERROR_OCCURRED AES256_CTL0_ERRFG |
#define AES256_NO_ERROR 0x00 |
#define AES256_BUSY AES256_STAT_BUSY |
#define AES256_NOT_BUSY 0x00 |
#define AES256_READY_INTERRUPT 0x01 |
#define AES256_NOTREADY_INTERRUPT 0x00 |
bool AES256_setCipherKey | ( | uint32_t | moduleInstance, |
const uint8_t * | cipherKey, | ||
uint_fast16_t | keyLength | ||
) |
Loads a 128, 192 or 256 bit cipher key to AES256 module.
moduleInstance | is the base address of the AES256 module. |
cipherKey | is a pointer to an uint8_t array with a length of 16 bytes that contains a 128 bit cipher key. |
keyLength | is the length of the key. Valid values are:
|
References AES256_CMSIS, AES256_KEYLENGTH_128BIT, AES256_KEYLENGTH_192BIT, and AES256_KEYLENGTH_256BIT.
void AES256_encryptData | ( | uint32_t | moduleInstance, |
const uint8_t * | data, | ||
uint8_t * | encryptedData | ||
) |
Encrypts a block of data using the AES256 module.
The cipher key that is used for encryption should be loaded in advance by using function AES256_setCipherKey()
moduleInstance | is the base address of the AES256 module. |
data | is a pointer to an uint8_t array with a length of 16 bytes that contains data to be encrypted. |
encryptedData | is a pointer to an uint8_t array with a length of 16 bytes in that the encrypted data will be written. |
References AES256_CMSIS.
void AES256_decryptData | ( | uint32_t | moduleInstance, |
const uint8_t * | data, | ||
uint8_t * | decryptedData | ||
) |
Decrypts a block of data using the AES256 module.
This function requires a pregenerated decryption key. A key can be loaded and pregenerated by using function AES256_setDecipherKey() or AES256_startSetDecipherKey(). The decryption takes 167 MCLK.
moduleInstance | is the base address of the AES256 module. |
data | is a pointer to an uint8_t array with a length of 16 bytes that contains encrypted data to be decrypted. |
decryptedData | is a pointer to an uint8_t array with a length of 16 bytes in that the decrypted data will be written. |
References AES256_CMSIS.
bool AES256_setDecipherKey | ( | uint32_t | moduleInstance, |
const uint8_t * | cipherKey, | ||
uint_fast16_t | keyLength | ||
) |
Sets the decipher key.
The API AES256_startSetDecipherKey or AES256_setDecipherKey must be invoked before invoking AES256_startDecryptData.
moduleInstance | is the base address of the AES256 module. |
cipherKey | is a pointer to an uint8_t array with a length of 16 bytes that contains a 128 bit cipher key. |
keyLength | is the length of the key. Valid values are:
|
References AES256_CMSIS, AES256_KEYLENGTH_128BIT, AES256_KEYLENGTH_192BIT, and AES256_KEYLENGTH_256BIT.
void AES256_clearInterruptFlag | ( | uint32_t | moduleInstance | ) |
Clears the AES256 ready interrupt flag.
moduleInstance | is the base address of the AES256 module. |
Modified bits are AESRDYIFG of AESACTL0 register.
References AES256_CMSIS.
uint32_t AES256_getInterruptFlagStatus | ( | uint32_t | moduleInstance | ) |
Gets the AES256 ready interrupt flag status.
moduleInstance | is the base address of the AES256 module. |
References AES256_CMSIS.
Referenced by AES256_getInterruptStatus().
void AES256_enableInterrupt | ( | uint32_t | moduleInstance | ) |
Enables AES256 ready interrupt.
moduleInstance | is the base address of the AES256 module. |
Modified bits are AESRDYIE of AESACTL0 register.
References AES256_CMSIS.
void AES256_disableInterrupt | ( | uint32_t | moduleInstance | ) |
Disables AES256 ready interrupt.
moduleInstance | is the base address of the AES256 module. |
Modified bits are AESRDYIE of AESACTL0 register.
References AES256_CMSIS.
void AES256_reset | ( | uint32_t | moduleInstance | ) |
Resets AES256 Module immediately.
moduleInstance | is the base address of the AES256 module. |
Modified bits are AESSWRST of AESACTL0 register.
References AES256_CMSIS.
void AES256_startEncryptData | ( | uint32_t | moduleInstance, |
const uint8_t * | data | ||
) |
Starts an encryption process on the AES256 module.
The cipher key that is used for decryption should be loaded in advance by using function AES256_setCipherKey(). This is a non-blocking equivalent pf AES256_encryptData(). It is recommended to use the interrupt functionality to check for procedure completion then use the AES256_getDataOut() API to retrieve the encrypted data.
moduleInstance | is the base address of the AES256 module. |
data | is a pointer to an uint8_t array with a length of 16 bytes that contains data to be encrypted. |
References AES256_CMSIS.
void AES256_startDecryptData | ( | uint32_t | moduleInstance, |
const uint8_t * | data | ||
) |
Decypts a block of data using the AES256 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 AES256_setDecipherKey() or AES256_startSetDecipherKey(). The decryption takes 167 MCLK. It is recommended to use interrupt to check for procedure completion then use the AES256_getDataOut() API to retrieve the decrypted data.
moduleInstance | is the base address of the AES256 module. |
data | is a pointer to an uint8_t array with a length of 16 bytes that contains encrypted data to be decrypted. |
References AES256_CMSIS.
bool AES256_startSetDecipherKey | ( | uint32_t | moduleInstance, |
const uint8_t * | cipherKey, | ||
uint_fast16_t | keyLength | ||
) |
Sets the decipher key.
The API AES256_startSetDecipherKey() or AES256_setDecipherKey() must be invoked before invoking AES256_startDecryptData.
moduleInstance | is the base address of the AES256 module. |
cipherKey | is a pointer to an uint8_t array with a length of 16 bytes that contains a 128 bit cipher key. |
keyLength | is the length of the key. Valid values are:
|
References AES256_CMSIS, AES256_KEYLENGTH_128BIT, AES256_KEYLENGTH_192BIT, and AES256_KEYLENGTH_256BIT.
bool AES256_getDataOut | ( | uint32_t | moduleInstance, |
uint8_t * | outputData | ||
) |
Reads back the output data from AES256 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 AES256_startEncryptData or AES256_startDecryptData functions.
moduleInstance | is the base address of the AES256 module. |
outputData | is a pointer to an uint8_t array with a length of 16 bytes in that the data will be written. |
References AES256_CMSIS.
bool AES256_isBusy | ( | uint32_t | moduleInstance | ) |
Gets the AES256 module busy status.
moduleInstance | is the base address of the AES256 module. |
References AES256_CMSIS.
void AES256_clearErrorFlag | ( | uint32_t | moduleInstance | ) |
Clears the AES256 error flag.
moduleInstance | is the base address of the AES256 module. |
Modified bits are AESERRFG of AESACTL0 register.
References AES256_CMSIS.
uint32_t AES256_getErrorFlagStatus | ( | uint32_t | moduleInstance | ) |
Gets the AES256 error flag status.
moduleInstance | is the base address of the AES256 module. |
References AES256_CMSIS.
void AES256_registerInterrupt | ( | uint32_t | moduleInstance, |
void(*)(void) | intHandler | ||
) |
Registers an interrupt handler for the AES interrupt.
moduleInstance | Instance of the AES256 module |
intHandler | is a pointer to the function to be called when the AES interrupt occurs. |
This function registers the handler to be called when a AES interrupt occurs. This function enables the global interrupt in the interrupt controller; specific AES interrupts must be enabled via AES256_enableInterrupt(). It is the interrupt handler's responsibility to clear the interrupt source via AES256_clearInterrupt().
References INT_AES256, Interrupt_enableInterrupt(), and Interrupt_registerInterrupt().
void AES256_unregisterInterrupt | ( | uint32_t | moduleInstance | ) |
Unregisters the interrupt handler for the AES interrupt
moduleInstance | Instance of the AES256 module |
This function unregisters the handler to be called when AES interrupt occurs. This function also masks off the interrupt in the interrupt controller so that the interrupt handler no longer is called.
References INT_AES256, Interrupt_disableInterrupt(), and Interrupt_unregisterInterrupt().
uint32_t AES256_getInterruptStatus | ( | uint32_t | moduleInstance | ) |
Returns the current interrupt flag for the peripheral.
moduleInstance | Instance of the AES256 module |
References AES256_getInterruptFlagStatus().