Advanced Encryption Standard Library
This Library provides a set of routines for easier handling of the Advanced Encryption Standard module available on CEC1x02 and MSP432 devices.
Library Routines
- aes_hash_power
- aes_hash_reset
- aes_busy
- aes_status
- aes_done_status
- aes_start
- aes_iclr
- aes_set_key
- aes_crypt
- AES256_setCipherKey
- AES256_encryptData
- AES256_decryptData
- AES256_setDecipherKey
- AES256_reset
- AES256_startEncryptData
- AES256_startDecryptData
- AES256_startSetDecipherKey
- AES256_getDataOut
- AES256_isBusy
- AES256_clearErrorFlag
- AES256_getErrorFlagStatus
- AES256_clearInterruptFlag
- AES256_getInterruptStatus
- AES256_enableInterrupt
- AES256_disableInterrupt
- AES256_getInterruptFlagStatus
aes_hash_power
Prototype |
void aes_hash_power(uint8_t pwr_state); |
||||||
---|---|---|---|---|---|---|---|
Description |
This function is used to enable or disable AES and Hash Hardware Block. |
||||||
Parameters |
|
||||||
Returns |
Nothing. |
||||||
Requires |
Nothing. |
||||||
Notes |
AES and Hash hardware accelerators do not implement a block level clock gate control and also share AHB resources (master, internal DMA, clocking).
|
aes_hash_reset
Prototype |
void aes_hash_reset(); |
---|---|
Description |
This function is used to reset the AES and Hash block. |
Parameters |
None. |
Returns |
Nothing. |
Requires |
Nothing. |
Notes |
None. |
aes_busy
Prototype |
uint16_t aes_busy(); |
---|---|
Description |
This function is used to check if the AES block is running. |
Parameters |
None. |
Returns |
|
Requires |
Nothing. |
Notes |
None. |
aes_status
Prototype |
uint32_t aes_status(); |
||||||||
---|---|---|---|---|---|---|---|---|---|
Description |
This function is used to read the status of the AES block. |
||||||||
Parameters |
None. |
||||||||
Returns |
The status of the AES block is reflected in the return value. The bit definitions of AES Status value is presented below :
|
||||||||
Requires |
Nothing. |
||||||||
Notes |
None. |
aes_done_status
Prototype |
uint16_t aes_done_status(uint32_t* status_value); |
---|---|
Description |
The function updates the status value of the AES block in the pointer argument. The done status is evaluated and it is returned as a Boolean value. |
Parameters |
|
Returns |
|
Requires |
Nothing. |
Notes |
None. |
aes_stop
Prototype |
uint8_t aes_stop(); |
---|---|
Description |
This function is used to stop the AES block. The function accesses the AES control register to stop the AES Operations. |
Parameters |
None. |
Returns |
The function returns the aes_busy function return value. |
Requires |
Nothing. |
Notes |
None. |
aes_start
Prototype |
void aes_start(uint8_t ien); |
---|---|
Description |
This function is used to start the AES Block. |
Parameters |
|
Returns |
The function returns the aes_busy function return value. |
Requires |
Nothing. |
Notes |
None. |
aes_iclr
Prototype |
uint32_t aes_iclr(); |
---|---|
Description |
The function is used to clear Hash interrupts. The function will return the status of AES Block. AES Status register is a read-to-clear register. If it is zero, no status is set. |
Parameters |
None. |
Returns |
The AES Status will be reflected in the return value. |
Requires |
Nothing. |
Notes |
None. |
aes_set_key
Prototype |
// for CEC1302 MCU :
uint8_t aes_set_key(const uint32_t *pkey, const uint32_t *piv, uint8_t key_len, int16_t msbf); // for CEC1702 MCU :uint8_t aes_set_key(const uint32_t *pkey, const uint32_t *piv, uint8_t key_len, uint8_t msbf); |
---|---|
Description |
The function programs the AES accelerator with key and optional initialization. AES key size and pre calculation mode are set. The AES engine is not started. |
Parameters |
|
Returns |
|
Requires |
Nothing. |
Notes |
Do not call this routine if the AES engine is busy. |
aes_crypt
Prototype |
uint8_t aes_crypt(const uint32_t *data_in, uint32_t *data_out, uint32_t num_128bit_blocks, uint8_t modes); |
---|---|
Description |
This function programs specified AES operation using currently programmed key. The hardware permits the following modes of operation: ECB, CBC, CTR and OFB modes. |
Parameters |
|
Returns |
|
Requires |
Nothing. |
Notes |
Hardware is limited to ECB, CBC, CTR and OFB modes! |
AES256_setCipherKey
Prototype |
uint8_t AES256_setCipherKey(uint32_t moduleInstance, const uint8_t *cipherKey, uint_fast16_t keyLength); |
---|---|
Description |
This function loads a 128, 192 or 256 bit cipher key to AES256 module. |
Parameters |
|
Returns |
|
Requires |
Nothing. |
Notes |
Available only for MSP432 devices. |
AES256_encryptData
Prototype |
void AES256_encryptData(uint32_t moduleInstance, const uint8_t *_data, uint8_t *encryptedData); |
---|---|
Description |
This function 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. |
Parameters |
|
Returns |
Nothing. |
Requires |
Nothing. |
Notes |
Available only for MSP432 devices. |
AES256_decryptData
Prototype |
void AES256_decryptData(uint32_t moduleInstance, const uint8_t *_data, uint8_t *decryptedData); |
---|---|
Description |
This function decrypts a block of data using the AES256 module. The decryption takes 167 MCLK. |
Parameters |
|
Returns |
Nothing. |
Requires |
This function requires a pregenerated decryption key. A key can be loaded and pregenerated by using function AES256_setDecipherKey or AES256_startSetDecipherKey. |
Notes |
Available only for MSP432 devices. |
AES256_setDecipherKey
Prototype |
uint8_t AES256_setDecipherKey(uint32_t moduleInstance, const uint8_t *cipherKey, uint_fast16_t keyLength); |
---|---|
Description |
This function sets the decipher key. |
Parameters |
|
Returns |
|
Requires |
The API AES256_setDecipherKey or AES256_startSetDecipherKey must be invoked before invoking AES256_setDecipherKey or AES256_startDecryptData. |
Notes |
Available only for MSP432 devices. |
AES256_reset
Prototype |
void AES256_reset(uint32_t moduleInstance); |
---|---|
Description |
This function resets AES256 Module immediately. Modified bits are AESSWRST of AESACTL0 register. |
Parameters |
|
Returns |
Nothing. |
Requires |
Nothing. |
Notes |
Available only for MSP432 devices. |
AES256_startEncryptData
Prototype |
void AES256_startEncryptData(uint32_t moduleInstance, const uint8_t *_data); |
---|---|
Description |
This function starts an encryption process on the AES256 module. This is a non-blocking equivalent of AES256_encryptData. |
Parameters |
|
Returns |
Nothing. |
Requires |
|
Notes |
Available only for MSP432 devices. |
AES256_startDecryptData
Prototype |
void AES256_startDecryptData(uint32_t moduleInstance, const uint8_t *_data); |
---|---|
Description |
This function decypts a block of data using the AES256 module. This is a non-blocking equivalent of AES256_decryptData.
|
Parameters |
|
Returns |
Nothing. |
Requires |
|
Notes |
Available only for MSP432 devices. |
AES256_startSetDecipherKey
Prototype |
uint8_t AES256_startSetDecipherKey(uint32_t moduleInstance, const uint8_t *cipherKey, uint_fast16_t keyLength); |
---|---|
Description |
This function sets the decipher key. |
Parameters |
|
Returns |
|
Requires |
The API AES256_setDecipherKey or AES256_startSetDecipherKey must be invoked before invoking AES256_startDecryptData. |
Notes |
Available only for MSP432 devices. |
AES256_getDataOut
Prototype |
uint8_t AES256_getDataOut(uint32_t moduleInstance, uint8_t outputData); |
---|---|
Description |
This function reads back the output data from AES256 module. |
Parameters |
|
Returns |
|
Requires |
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. |
Notes |
Available only for MSP432 devices. |
AES256_isBusy
Prototype |
uint8_t AES256_isBusy(uint32_t moduleInstance); |
---|---|
Description |
This function gets the AES256 module busy status. |
Parameters |
|
Returns |
|
Requires |
Nothing. |
Notes |
Available only for MSP432 devices. |
AES256_clearErrorFlag
Prototype |
void AES256_clearErrorFlag(uint32_t moduleInstance); |
---|---|
Description |
This function clears the AES256 error flag. Modified bits are AESERRFG of AESACTL0 register. |
Parameters |
|
Returns |
Nothing. |
Requires |
Nothing. |
Notes |
Available only for MSP432 devices. |
AES256_getErrorFlagStatus
Prototype |
uint32_t AES256_getErrorFlagStatus(uint32_t moduleInstance); |
---|---|
Description |
This function gets the AES256 error flag status. |
Parameters |
|
Returns |
|
Requires |
Nothing. |
Notes |
Available only for MSP432 devices. |
AES256_clearInterruptFlag
Prototype |
void AES256_clearInterruptFlag(uint32_t moduleInstance); |
---|---|
Description |
This function clears the AES256 ready interrupt flag. Modified bits are AESRDYIFG of AESACTL0 register. |
Parameters |
|
Returns |
Nothing. |
Requires |
Nothing. |
Notes |
Available only for MSP432 devices. |
AES256_getInterruptStatus
Prototype |
uint32_t AES256_getInterruptStatus(uint32_t moduleInstance); |
---|---|
Description |
This function returns the current interrupt flag for the peripheral. References AES256_getInterruptFlagStatus. |
Parameters |
|
Returns |
Returns the currently triggered interrupt flag for the module. |
Requires |
Nothing. |
Notes |
Available only for MSP432 devices. |
AES256_enableInterrupt
Prototype |
void AES256_enableInterrupt(uint32_t moduleInstance); |
---|---|
Description |
This function enables AES256 ready interrupt. Modified bits are AESRDYIE of AESACTL0 register. |
Parameters |
|
Returns |
Nothing. |
Requires |
Nothing. |
Notes |
Available only for MSP432 devices. |
AES256_disableInterrupt
Prototype |
void AES256_disableInterrupt(uint32_t moduleInstance); |
---|---|
Description |
This function disables AES256 ready interrupt. Modified bits are AESRDYIE of AESACTL0 register. |
Parameters |
|
Returns |
Nothing. |
Requires |
Nothing. |
Notes |
Available only for MSP432 devices. |
AES256_getInterruptFlagStatus
Prototype |
uint32_t AES256_getInterruptFlagStatus(uint32_t moduleInstance); |
---|---|
Description |
This function gets the AES256 ready interrupt flag status. Referenced by AES256_getInterruptStatus.. |
Parameters |
|
Returns |
|
Requires |
Nothing. |
Notes |
Available only for MSP432 devices. |
What do you think about this topic ? Send us feedback!