Macros

#define EMBER_AES_BLOCK_SIZE_BYTES 16
The number of bytes in a 128-bit AES block.

Functions

void emberAesEcbEncryptBlock (uint8_t *block, const uint8_t *key, bool sameKey)
This function performs a standalone-mode "electronic code book" (ECB) AES-128 encryption of the 16-byte plaintext block using the 128-bit (16-byte) key . The resulting 16 byte ciphertext overwrites the plaintext block .
void emberAesCtrCryptData (uint8_t *nonce, const uint8_t *key, uint8_t *data, uint32_t dataLen, uint32_t dataDid)
This function performs a counter-mode (CTR) AES-128 encrypt/decrypt of the data for dataLen bytes, using the 128-bit (16-byte) key and 128-bit (16-byte) nonce . The resulting encrypted/decrypted data overwrites the data passed in.

Detailed Description

See aes.h for source code.

Macro Definition Documentation

#define EMBER_AES_BLOCK_SIZE_BYTES   16

Function Documentation

void emberAesCtrCryptData ( uint8_t * nonce,
const uint8_t * key,
uint8_t * data,
uint32_t dataLen,
uint32_t dataDid
)
Parameters
nonce The big-endian nonce (MSB is nonce[0] and LSB is nonce[15]) serves as a 128-bit block counter for every 16-byte block of data . It is incremented by the number of blocks processed ((dataLen+15)/16).
key A pointer to the 128-bit key to be used for the nonce encryption.
data A pointer to the plain- or cypher-text to be encrypted/decrypted in place.
dataLen Indicates the number of bytes of data. It need not be a multiple of 16 bytes.
dataDid This parameter allows splitting a CTR operation across multiple calls. The first call passes in dataDid of 0 to start a fresh CTR. Then subsequent calls pass in dataDid of the sum of the previous calls' dataLen values (with data and dataLen representing the new portion to encrypt/decrypt). A non-zero dataDid indicates a continuation of the prior CTR operation which will pick up where the earlier one left off.
Note
If your nonce is divided into a fixed and counter portion, ensure that the counter value passed in is such that when incremented by the number of blocks ((dataLen+15)/16) it won't overflow the counter portion into the fixed portion of the nonce. It may be necessary to split the operation across multiple calls to emberAesCtrCryptData() to satisfy this criteria.
void emberAesEcbEncryptBlock ( uint8_t * block,
const uint8_t * key,
bool sameKey
)
Parameters
block A pointer to the 128-bit data in RAM to be encrypted in place.
key A pointer to the 128-bit key to be used for the encryption.
sameKey If true, indicates that the 128-bit key value is the same as it was in a prior call to this routine and serves as a hint that the key needn't be reloaded into the AES hardware engine. Otherwise, the key value is considered new and will always be loaded.