CC26xx Driver Library
aes.h File Reference
#include <stdbool.h>
#include <stdint.h>
#include <string.h>
#include "../inc/hw_types.h"
#include "../inc/hw_memmap.h"
#include "../inc/hw_ints.h"
#include "../inc/hw_crypto.h"
#include "debug.h"
#include "interrupt.h"
#include "cpu.h"

Macros

#define AES_DMA_IN_DONE   CRYPTO_IRQEN_DMA_IN_DONE_M
 
#define AES_RESULT_RDY   CRYPTO_IRQEN_RESULT_AVAIL_M
 
#define AES_DMA_BUS_ERR   CRYPTO_IRQCLR_DMA_BUS_ERR_M
 
#define AES_KEY_ST_WR_ERR   CRYPTO_IRQCLR_KEY_ST_WR_ERR_M
 
#define AES_KEY_ST_RD_ERR   CRYPTO_IRQCLR_KEY_ST_RD_ERR_M
 
#define AES_SUCCESS   0
 
#define AES_KEYSTORE_ERROR   1
 
#define AES_KEYSTORE_AREA_INVALID   2
 
#define AES_DMA_BUSY   3
 
#define AES_DMA_ERROR   4
 
#define AES_TAG_NOT_READY   5
 
#define AES_TAG_VERIFICATION_FAILED   6
 
#define AES_IV_LENGTH_BYTES   16
 
#define AES_TAG_LENGTH_BYTES   16
 
#define AES_128_KEY_LENGTH_BYTES   (128 / 8)
 
#define AES_192_KEY_LENGTH_BYTES   (192 / 8)
 
#define AES_256_KEY_LENGTH_BYTES   (256 / 8)
 
#define AES_BLOCK_SIZE   16
 
#define AES_DMA_CHANNEL0_ACTIVE   CRYPTO_DMASTAT_CH0_ACT_M
 
#define AES_DMA_CHANNEL1_ACTIVE   CRYPTO_DMASTAT_CH1_ACT_M
 
#define AES_DMA_PORT_ERROR   CRYPTO_DMASTAT_PORT_ERR_M
 
#define AES_ALGSEL_AES   CRYPTO_ALGSEL_AES_M
 
#define AES_ALGSEL_KEY_STORE   CRYPTO_ALGSEL_KEY_STORE_M
 
#define AES_ALGSEL_TAG   CRYPTO_ALGSEL_TAG_M
 
#define AES_KEY_AREA_0   0
 
#define AES_KEY_AREA_1   1
 
#define AES_KEY_AREA_2   2
 
#define AES_KEY_AREA_3   3
 
#define AES_KEY_AREA_4   4
 
#define AES_KEY_AREA_5   5
 
#define AES_KEY_AREA_6   6
 
#define AES_KEY_AREA_7   7
 
#define AES_CTR_WIDTH_32   0x0
 
#define AES_CTR_WIDTH_64   0x1
 
#define AES_CTR_WIDTH_96   0x2
 
#define AES_CTR_WIDTH_128   0x3
 

Functions

void AESStartDMAOperation (const uint8_t *channel0Addr, uint32_t channel0Length, uint8_t *channel1Addr, uint32_t channel1Length)
 Start a crypto DMA operation. More...
 
void AESSetInitializationVector (const uint32_t *initializationVector)
 Write the initialization vector (IV) to the crypto module. More...
 
void AESWriteCCMInitializationVector (const uint8_t *nonce, uint32_t nonceLength)
 Generate and load the initialization vector for a CCM operation. More...
 
uint32_t AESReadTag (uint8_t *tag, uint32_t tagLength)
 Read the tag out from the crypto module. More...
 
uint32_t AESVerifyTag (const uint8_t *tag, uint32_t tagLength)
 Verifies the provided tag against calculated one. More...
 
uint32_t AESWriteToKeyStore (const uint8_t *aesKey, uint32_t aesKeyLength, uint32_t keyStoreArea)
 Transfer a key from main memory to a key area within the key store. More...
 
uint32_t AESReadFromKeyStore (uint32_t keyStoreArea)
 Transfer a key from key store area to the internal buffers within the hardware module. More...
 
uint32_t AESWaitForIRQFlags (uint32_t irqFlags)
 Poll the interrupt status register and clear when done. More...
 
void AESConfigureCCMCtrl (uint32_t nonceLength, uint32_t macLength, bool encrypt)
 Configure AES engine for CCM operation. More...
 
static void AESInvalidateKey (uint32_t keyStoreArea)
 Invalidate a key in the key store. More...
 
static void AESSelectAlgorithm (uint32_t algorithm)
 Select type of operation. More...
 
static void AESSetCtrl (uint32_t ctrlMask)
 Set up the next crypto module operation. More...
 
static void AESSetDataLength (uint32_t length)
 Specify length of the crypto operation. More...
 
static void AESSetAuthLength (uint32_t length)
 Specify the length of the additional authentication data (AAD). More...
 
static void AESReset (void)
 Reset the accelerator and cancel ongoing operations. More...
 
static void AESIntEnable (uint32_t intFlags)
 Enable individual crypto interrupt sources. More...
 
static void AESIntDisable (uint32_t intFlags)
 Disable individual crypto interrupt sources. More...
 
static uint32_t AESIntStatusMasked (void)
 Get the current masked interrupt status. More...
 
static uint32_t AESIntStatusRaw (void)
 Get the current raw interrupt status. More...
 
static void AESIntClear (uint32_t intFlags)
 Clear crypto interrupt sources. More...
 
static void AESIntRegister (void(*handlerFxn)(void))
 Register an interrupt handler for a crypto interrupt. More...
 
static void AESIntUnregister (void)
 Unregister an interrupt handler for a crypto interrupt. More...