![]() |
Contiki-NG
|
Driver for the cc2538 AES modes of the security core. More...
Topics | |
| CC2538 AES-128 | |
| AES-128 driver for the CC2538 SoC. | |
| CC2538 AES-CCM* | |
| AES-CCM* driver for the CC2538 SoC. | |
| cc2538 AES-CBC | |
| Driver for the cc2538 AES-CBC mode of the security core. | |
| cc2538 AES-CBC-MAC | |
| Driver for the cc2538 AES-CBC-MAC mode of the security core. | |
| cc2538 AES-CCM | |
| Driver for the cc2538 AES-CCM mode of the security core. | |
| cc2538 AES-CTR | |
| Driver for the cc2538 AES-CTR mode of the security core. | |
| cc2538 AES-ECB | |
| Driver for the cc2538 AES-ECB mode of the security core. | |
| cc2538 AES-GCM | |
| Driver for the cc2538 AES-GCM mode of the security core. | |
Files | |
| file | arch/cpu/cc2538/dev/aes.c |
| Implementation of the cc2538 AES driver. | |
| file | arch/cpu/cc2538/dev/aes.h |
| Header file for the cc2538 AES driver. | |
AES functions | |
| uint8_t | aes_load_keys (const void *keys, uint8_t key_size, uint8_t count, uint8_t start_area) |
| Writes keys into the Key RAM. | |
| uint8_t | aes_auth_crypt_start (uint32_t ctrl, uint8_t key_area, const void *iv, const void *adata, uint16_t adata_len, const void *data_in, void *data_out, uint16_t data_len, struct process *process) |
| Starts an AES authentication/crypto operation. | |
| uint8_t | aes_auth_crypt_check_status (void) |
| Checks the status of the AES authentication/crypto operation. | |
| uint8_t | aes_auth_crypt_get_result (void *iv, void *tag) |
| Gets the result of the AES authentication/crypto operation. | |
AES_DMAC_CHx_CTRL registers bit fields | |
| #define | AES_DMAC_CH_CTRL_PRIO 0x00000002 |
| Channel priority 0: Low 1: High. | |
| #define | AES_DMAC_CH_CTRL_EN 0x00000001 |
| Channel enable. | |
AES_DMAC_SWRES register bit fields | |
| #define | AES_DMAC_SWRES_SWRES 0x00000001 |
| Software reset enable. | |
AES_DMAC_PERSR register bit fields | |
| #define | AES_DMAC_PERSR_PORT1_AHB_ERROR 0x00001000 |
| AHB bus error. | |
| #define | AES_DMAC_PERSR_PORT1_CHANNEL 0x00000200 |
| Last serviced channel (0 or 1). | |
AES_AES_CTRL register bit fields | |
| #define | AES_AES_CTRL_CONTEXT_READY 0x80000000 |
| Context data registers can be overwritten. | |
| #define | AES_AES_CTRL_SAVED_CONTEXT_READY 0x40000000 |
| AES auth. | |
| #define | AES_AES_CTRL_SAVE_CONTEXT 0x20000000 |
| Auth. | |
| #define | AES_AES_CTRL_CCM_M_M 0x01C00000 |
| CCM auth. | |
| #define | AES_AES_CTRL_CCM_M_S 22 |
| CCM auth. | |
| #define | AES_AES_CTRL_CCM_L_M 0x00380000 |
| CCM length field width mask. | |
| #define | AES_AES_CTRL_CCM_L_S 19 |
| CCM length field width shift. | |
| #define | AES_AES_CTRL_CCM 0x00040000 |
| AES-CCM mode. | |
| #define | AES_AES_CTRL_GCM 0x00030000 |
| AES-GCM mode. | |
| #define | AES_AES_CTRL_CBC_MAC 0x00008000 |
| AES-CBC MAC mode. | |
| #define | AES_AES_CTRL_CTR_WIDTH_32 (0 << 7) |
| CTR counter width: 32 bits. | |
| #define | AES_AES_CTRL_CTR_WIDTH_64 (1 << 7) |
| CTR counter width: 64 bits. | |
| #define | AES_AES_CTRL_CTR_WIDTH_96 (2 << 7) |
| CTR counter width: 96 bits. | |
| #define | AES_AES_CTRL_CTR_WIDTH_128 (3 << 7) |
| CTR counter width: 128 bits. | |
| #define | AES_AES_CTRL_CTR_WIDTH_M 0x00000180 |
| CTR counter width mask. | |
| #define | AES_AES_CTRL_CTR_WIDTH_S 7 |
| CTR counter width shift. | |
| #define | AES_AES_CTRL_CTR 0x00000040 |
| AES-CTR mode. | |
| #define | AES_AES_CTRL_CBC 0x00000020 |
| AES-CBC mode. | |
| #define | AES_AES_CTRL_KEY_SIZE_128 (1 << 3) |
| Key size: 128 bits. | |
| #define | AES_AES_CTRL_KEY_SIZE_192 (2 << 3) |
| Key size: 192 bits. | |
| #define | AES_AES_CTRL_KEY_SIZE_256 (3 << 3) |
| Key size: 256 bits. | |
| #define | AES_AES_CTRL_KEY_SIZE_M 0x00000018 |
| Key size mask. | |
| #define | AES_AES_CTRL_KEY_SIZE_S 3 |
| Key size shift. | |
| #define | AES_AES_CTRL_DIRECTION_ENCRYPT 0x00000004 |
| Encrypt. | |
| #define | AES_AES_CTRL_INPUT_READY 0x00000002 |
| AES input buffer empty. | |
| #define | AES_AES_CTRL_OUTPUT_READY 0x00000001 |
| AES output block available. | |
AES_AES_C_LENGTH_1 register bit fields | |
| #define | AES_AES_C_LENGTH_1_C_LENGTH_M 0x1FFFFFFF |
| Crypto length bits [60:32] mask. | |
| #define | AES_AES_C_LENGTH_1_C_LENGTH_S 0 |
| Crypto length bits [60:32] shift. | |
AES_HASH_MODE_IN register bit fields | |
| #define | AES_HASH_MODE_IN_SHA256_MODE 0x00000008 |
| Hash mode. | |
| #define | AES_HASH_MODE_IN_NEW_HASH 0x00000001 |
| New hash session. | |
AES_CTRL_PROT_EN register bit fields | |
| #define | AES_CTRL_PROT_EN_PROT_EN 0x00000001 |
| m_h_prot[1] asserted for DMA reads towards key store | |
AES_CTRL_SW_RESET register bit fields | |
| #define | AES_CTRL_SW_RESET_SW_RESET 0x00000001 |
| Reset master control and key store. | |
AES_CTRL_INT_CFG register bit fields | |
| #define | AES_CTRL_INT_CFG_LEVEL 0x00000001 |
| Level interrupt type. | |
AES_CTRL_INT_EN register bit fields | |
| #define | AES_CTRL_INT_EN_DMA_IN_DONE 0x00000002 |
| DMA input done interrupt enabled. | |
| #define | AES_CTRL_INT_EN_RESULT_AV 0x00000001 |
| Result available interrupt enabled. | |
AES_CTRL_INT_SET register bit fields | |
| #define | AES_CTRL_INT_SET_DMA_IN_DONE 0x00000002 |
| Set DMA data in done interrupt. | |
| #define | AES_CTRL_INT_SET_RESULT_AV 0x00000001 |
| Set result available interrupt. | |
Driver for the cc2538 AES modes of the security core.
| #define AES_AES_CTRL_CCM_M_M 0x01C00000 |
| #define AES_AES_CTRL_SAVE_CONTEXT 0x20000000 |
Auth.
TAG or result IV needs to be stored
Definition at line 273 of file aes.h.
Referenced by cbc_mac_auth_start().
| #define AES_AES_CTRL_SAVED_CONTEXT_READY 0x40000000 |
AES auth.
TAG and/or IV block(s) available
Definition at line 271 of file aes.h.
Referenced by aes_auth_crypt_get_result().
| uint8_t aes_auth_crypt_check_status | ( | void | ) |
Checks the status of the AES authentication/crypto operation.
| false | Result not yet available, and no error occurred |
| true | Result available, or error occurred |
< Interrupt status
< DMA bus error detected
< Write error detected
< Read error detected
< Result available interrupt status
Definition at line 270 of file aes.c.
References AES_CTRL_INT_STAT, AES_CTRL_INT_STAT_DMA_BUS_ERR, AES_CTRL_INT_STAT_KEY_ST_RD_ERR, AES_CTRL_INT_STAT_KEY_ST_WR_ERR, and AES_CTRL_INT_STAT_RESULT_AV.
Referenced by cbc_crypt_check_status(), ctr_crypt_check_status(), and ecb_crypt_check_status().
| uint8_t aes_auth_crypt_get_result | ( | void * | iv, |
| void * | tag ) |
Gets the result of the AES authentication/crypto operation.
| iv | Pointer to 128-bit result initialization vector, or NULL |
| tag | Pointer to 128-bit result tag, or NULL |
CRYPTO_SUCCESS if successful, or CRYPTO/AES error code aes_auth_crypt_start(). < Interrupt status
< Interrupt clear
< Clear DMA bus error status
< Clear key store write error status
< Clear key store read error status
< Algorithm select
< DMA bus error detected
< Write error detected
< Read error detected
< AES input/output buffer control and mode
< AES auth. TAG and/or IV block(s) available
< AES initialization vector
< AES initialization vector
< AES initialization vector
< AES initialization vector
< TAG
< TAG
< TAG
< TAG
< Interrupt clear
< Clear DMA in done interrupt
< Clear result available interrupt
Definition at line 278 of file aes.c.
References AES_AES_CTRL, AES_AES_CTRL_SAVED_CONTEXT_READY, AES_AES_IV_0, AES_AES_IV_1, AES_AES_IV_2, AES_AES_IV_3, AES_AES_TAG_OUT_0, AES_AES_TAG_OUT_1, AES_AES_TAG_OUT_2, AES_AES_TAG_OUT_3, AES_CTRL_ALG_SEL, AES_CTRL_INT_CLR, AES_CTRL_INT_CLR_DMA_BUS_ERR, AES_CTRL_INT_CLR_DMA_IN_DONE, AES_CTRL_INT_CLR_KEY_ST_RD_ERR, AES_CTRL_INT_CLR_KEY_ST_WR_ERR, AES_CTRL_INT_CLR_RESULT_AV, AES_CTRL_INT_STAT, AES_CTRL_INT_STAT_DMA_BUS_ERR, AES_CTRL_INT_STAT_KEY_ST_RD_ERR, AES_CTRL_INT_STAT_KEY_ST_WR_ERR, AES_IRQn, and crypto_register_process_notification().
Referenced by cbc_crypt_check_status(), cbc_mac_auth_get_result(), ctr_crypt_check_status(), and ecb_crypt_check_status().
| uint8_t aes_auth_crypt_start | ( | uint32_t | ctrl, |
| uint8_t | key_area, | ||
| const void * | iv, | ||
| const void * | adata, | ||
| uint16_t | adata_len, | ||
| const void * | data_in, | ||
| void * | data_out, | ||
| uint16_t | data_len, | ||
| struct process * | process ) |
Starts an AES authentication/crypto operation.
| ctrl | Contents of the AES_AES_CTRL register |
| key_area | Area in Key RAM where the key is stored (0 to AES_KEY_AREAS - 1) |
| iv | Pointer to 128-bit initialization vector, or NULL |
| adata | Pointer to additional authenticated data in SRAM, or NULL |
| adata_len | Length of additional authenticated data in octets, or 0 |
| data_in | Pointer to input payload data in SRAM, or NULL |
| data_out | Pointer to output payload data in SRAM (may be data_in), or NULL |
| data_len | Length of payload data in octets, or 0 |
| process | Process to be polled upon completion of the operation, or NULL |
CRYPTO_SUCCESS if successful, or CRYPTO/AES error code < Algorithm select
< Interrupt configuration
< Level interrupt type
< Interrupt enable
< DMA input done interrupt enabled
< Result available interrupt enabled
< Algorithm select
< Select AES engine as DMA source/destination
< Interrupt clear
< Clear DMA in done interrupt
< Clear result available interrupt
< Key store read area
< Key store read area
< Key store operation busy
< Interrupt status
< Read error detected
< Interrupt clear
< Clear key store read error status
< Algorithm select
< AES initialization vector
< AES initialization vector
< AES initialization vector
< AES initialization vector
< AES input/output buffer control and mode
< AES crypto length (LSW)
< AES crypto length (MSW)
< AES-CCM mode
< AES-GCM mode
< Authentication length
< Channel 0 control
< Channel enable
< Channel 0 external address
< Channel 0 DMA length
< Interrupt status
< DMA data in done interrupt status
< Interrupt status
< DMA bus error detected
< Interrupt clear
< Clear DMA bus error status
< Algorithm select
< Interrupt clear
< Clear DMA in done interrupt
< Interrupt enable
< Result available interrupt enabled
< Channel 0 control
< Channel enable
< Channel 0 external address
< Channel 0 DMA length
< Channel 1 control
< Channel enable
< Channel 1 external address
< Channel 1 DMA length
Definition at line 159 of file aes.c.
References AES_AES_AUTH_LENGTH, AES_AES_C_LENGTH_0, AES_AES_C_LENGTH_1, AES_AES_CTRL, AES_AES_CTRL_CCM, AES_AES_CTRL_GCM, AES_AES_IV_0, AES_AES_IV_1, AES_AES_IV_2, AES_AES_IV_3, AES_CTRL_ALG_SEL, AES_CTRL_ALG_SEL_AES, AES_CTRL_INT_CFG, AES_CTRL_INT_CFG_LEVEL, AES_CTRL_INT_CLR, AES_CTRL_INT_CLR_DMA_BUS_ERR, AES_CTRL_INT_CLR_DMA_IN_DONE, AES_CTRL_INT_CLR_KEY_ST_RD_ERR, AES_CTRL_INT_CLR_RESULT_AV, AES_CTRL_INT_EN, AES_CTRL_INT_EN_DMA_IN_DONE, AES_CTRL_INT_EN_RESULT_AV, AES_CTRL_INT_STAT, AES_CTRL_INT_STAT_DMA_BUS_ERR, AES_CTRL_INT_STAT_DMA_IN_DONE, AES_CTRL_INT_STAT_KEY_ST_RD_ERR, AES_DMAC_CH0_CTRL, AES_DMAC_CH0_DMALENGTH, AES_DMAC_CH0_EXTADDR, AES_DMAC_CH1_CTRL, AES_DMAC_CH1_DMALENGTH, AES_DMAC_CH1_EXTADDR, AES_DMAC_CH_CTRL_EN, AES_IRQn, AES_KEY_STORE_READ_AREA, AES_KEY_STORE_READ_AREA_BUSY, and crypto_register_process_notification().
Referenced by cbc_crypt_start(), cbc_mac_auth_start(), ctr_crypt_start(), and ecb_crypt_start().
| uint8_t aes_load_keys | ( | const void * | keys, |
| uint8_t | key_size, | ||
| uint8_t | count, | ||
| uint8_t | start_area ) |
Writes keys into the Key RAM.
| keys | Pointer to AES Keys |
| key_size | Key size: AES_KEY_STORE_SIZE_KEY_SIZE_x |
| count | Number of keys (1 to AES_KEY_AREAS - start_area for 128-bit keys, 1 to (AES_KEY_AREAS - start_area) / 2 for 192- and 256-bit keys) |
| start_area | Start area in Key RAM where to store the keys (0 to AES_KEY_AREAS - 1, must be even for 192- and 256-bit keys) |
CRYPTO_SUCCESS if successful, or CRYPTO/AES error code key_size different from the one passed for the previous calls causes the deletion of all previously stored keys. < Algorithm select
< Key size: 192 bits
< Key size: 128 bits
< Key size: 192 bits
< Interrupt configuration
< Level interrupt type
< Interrupt enable
< DMA input done interrupt enabled
< Result available interrupt enabled
< Algorithm select
< Select Key Store as DMA destination
< Interrupt clear
< Clear DMA in done interrupt
< Clear result available interrupt
< Key store size
< Key size mask
< Key store size
< Key size mask
< Key store written area
< Key store write area
< Channel 0 control
< Channel enable
< Channel 0 external address
< Channel 0 DMA length
< Channel 0 DMA length
< Channel DMA length in bytes mask
< Channel DMA length in bytes shift
< Interrupt status
< Result available interrupt status
< Channel 0 external address
< Interrupt status
< DMA bus error detected
< Interrupt clear
< Clear DMA bus error status
< Algorithm select
< Interrupt status
< Write error detected
< Interrupt clear
< Clear key store write error status
< Algorithm select
< Interrupt clear
< Clear DMA in done interrupt
< Clear result available interrupt
< Algorithm select
< Key store written area
Definition at line 53 of file aes.c.
References AES_CTRL_ALG_SEL, AES_CTRL_ALG_SEL_KEYSTORE, AES_CTRL_INT_CFG, AES_CTRL_INT_CFG_LEVEL, AES_CTRL_INT_CLR, AES_CTRL_INT_CLR_DMA_BUS_ERR, AES_CTRL_INT_CLR_DMA_IN_DONE, AES_CTRL_INT_CLR_KEY_ST_WR_ERR, AES_CTRL_INT_CLR_RESULT_AV, AES_CTRL_INT_EN, AES_CTRL_INT_EN_DMA_IN_DONE, AES_CTRL_INT_EN_RESULT_AV, AES_CTRL_INT_STAT, AES_CTRL_INT_STAT_DMA_BUS_ERR, AES_CTRL_INT_STAT_KEY_ST_WR_ERR, AES_CTRL_INT_STAT_RESULT_AV, AES_DMAC_CH0_CTRL, AES_DMAC_CH0_DMALENGTH, AES_DMAC_CH0_EXTADDR, AES_DMAC_CH_CTRL_EN, AES_DMAC_CH_DMALENGTH_DMALEN_M, AES_DMAC_CH_DMALENGTH_DMALEN_S, AES_KEY_STORE_SIZE, AES_KEY_STORE_SIZE_KEY_SIZE_128, AES_KEY_STORE_SIZE_KEY_SIZE_192, AES_KEY_STORE_SIZE_KEY_SIZE_M, AES_KEY_STORE_WRITE_AREA, AES_KEY_STORE_WRITTEN_AREA, and count.