The extended feature set of at86rf2xx transceivers comprises a hardware implementation of AES. More...
The extended feature set of at86rf2xx transceivers comprises a hardware implementation of AES.
There are two supported block cipher modes, ECB and CBC.
Interface of the at86rf2xx security module (AES)
Definition in file at86rf2xx_aes.h.
#include "at86rf2xx.h"
Go to the source code of this file.
Typedefs | |
typedef uint8_t | aes_block_t[AT86RF2XX_AES_BLOCK_SIZE] |
An AES block. | |
Functions | |
void | at86rf2xx_aes_key_read_encrypt (at86rf2xx_t *dev, uint8_t key[AT86RF2XX_AES_KEY_LENGTH]) |
Read the AES key used for encryption. | |
void | at86rf2xx_aes_key_write_encrypt (at86rf2xx_t *dev, const uint8_t key[AT86RF2XX_AES_KEY_LENGTH]) |
Write the AES key used for encryption. | |
void | at86rf2xx_aes_key_read_decrypt (at86rf2xx_t *dev, uint8_t key[AT86RF2XX_AES_KEY_LENGTH]) |
Read the AES key used for decryption. | |
void | at86rf2xx_aes_key_write_decrypt (at86rf2xx_t *dev, const uint8_t key[AT86RF2XX_AES_KEY_LENGTH]) |
Write the AES key used for decryption. | |
void | at86rf2xx_aes_ecb_encrypt (at86rf2xx_t *dev, aes_block_t *cipher, uint8_t key[AT86RF2XX_AES_BLOCK_SIZE], const aes_block_t *plain, uint8_t nblocks) |
Perform AES algorithm and encrypt data blocks in plain to cipher data blocks, using ECB mode. | |
void | at86rf2xx_aes_ecb_decrypt (at86rf2xx_t *dev, aes_block_t *plain, uint8_t key[AT86RF2XX_AES_BLOCK_SIZE], const aes_block_t *cipher, uint8_t nblocks) |
Perform AES algorithm and decrypt data blocks in cipher to plain data blocks, using ECB mode. | |
void | at86rf2xx_aes_cbc_encrypt (at86rf2xx_t *dev, aes_block_t *cipher, uint8_t key[AT86RF2XX_AES_BLOCK_SIZE], uint8_t iv[AT86RF2XX_AES_BLOCK_SIZE], const aes_block_t *plain, uint8_t nblocks) |
Perform AES algorithm and encrypt data blocks in plain to cipher data blocks, using CBC mode. | |
void | at86rf2xx_aes_cbc_decrypt (at86rf2xx_t *dev, aes_block_t *plain, uint8_t key[AT86RF2XX_AES_BLOCK_SIZE], uint8_t iv[AT86RF2XX_AES_BLOCK_SIZE], const aes_block_t *cipher, uint8_t nblocks) |
Perform AES algorithm and decrypt data blocks in cipher to plain data blocks, using CBC mode. | |
#define | AT86RF2XX_AES_KEY_BITS (128U) |
AES key length in bits. | |
#define | AT86RF2XX_AES_KEY_LENGTH ((AT86RF2XX_AES_KEY_BITS) / 8) |
AES key length in bytes. | |
#define | AT86RF2XX_AES_BLOCK_SIZE ((AT86RF2XX_AES_KEY_BITS) / 8) |
AES block size in bytes. | |
#define | AT86RF2XX_AES_DELAY_US (24) |
Time to complete the AES algorithm in us. | |
AES rigister addresses | |
#define | AT86RF2XX_REG__AES_STATUS (0x82) |
#define | AT86RF2XX_REG__AES_CTRL (0x83) |
#define | AT86RF2XX_REG__AES_KEY_START (0x84) |
#define | AT86RF2XX_REG__AES_KEY_END (0x93) |
#define | AT86RF2XX_REG__AES_DATA_START (0x84) |
#define | AT86RF2XX_REG__AES_DATA_END (0x93) |
#define | AT86RF2XX_REG__AES_CTRL_MIRROR (0x94) |
Layout of register AES_STATUS | |
#define | AT86RF2XX_AES_STATUS_MASK__AES_ER (0x80) |
#define | AT86RF2XX_AES_STATUS_MASK__AES_DONE (0x01) |
#define | AT86RF2XX_AES_STATUS_AES_ER__NO_ERROR (0x00) |
#define | AT86RF2XX_AES_STATUS_AES_ER__ERROR (0x80) |
#define | AT86RF2XX_AES_STATUS_AES_DONE__NOT_DONE (0x00) |
#define | AT86RF2XX_AES_STATUS_AES_DONE__DONE (0x01) |
Layout of register AES_CTRL | |
#define | AT86RF2XX_AES_CTRL_MASK__AES_REQUEST (0x80) |
#define | AT86RF2XX_AES_CTRL_MASK__AES_MODE (0x70) |
#define | AT86RF2XX_AES_CTRL_MASK__AES_DIR (0x08) |
#define | AT86RF2XX_AES_CTRL_AES_REQUEST__IDLE (0x00) |
#define | AT86RF2XX_AES_CTRL_AES_REQUEST__START (0x80) |
#define | AT86RF2XX_AES_CTRL_AES_MODE__ECB (0x00) |
#define | AT86RF2XX_AES_CTRL_AES_MODE__KEY (0x10) |
#define | AT86RF2XX_AES_CTRL_AES_MODE__CBC (0x20) |
#define | AT86RF2XX_AES_CTRL_AES_DIR__ENC (0x00) |
#define | AT86RF2XX_AES_CTRL_AES_DIR__DEC (0x08) |
Layout of register AES_CTRL_MIRROR | |
#define | AT86RF2XX_AES_CTRL_MIRROR_MASK__AES_REQUEST (0x80) |
#define | AT86RF2XX_AES_CTRL_MIRROR_MASK__AES_MODE (0x70) |
#define | AT86RF2XX_AES_CTRL_MIRROR_MASK__AES_DIR (0x08) |
#define | AT86RF2XX_AES_CTRL_MIRROR_AES_REQUEST__IDLE (0x00) |
#define | AT86RF2XX_AES_CTRL_MIRROR_AES_REQUEST__START (0x80) |
#define | AT86RF2XX_AES_CTRL_MIRROR_AES_MODE__ECB (0x00) |
#define | AT86RF2XX_AES_CTRL_MIRROR_AES_MODE__KEY (0x10) |
#define | AT86RF2XX_AES_CTRL_MIRROR_AES_MODE__CBC (0x20) |
#define | AT86RF2XX_AES_CTRL_MIRROR_AES_DIR__ENC (0x00) |
#define | AT86RF2XX_AES_CTRL_MIRROR_AES_DIR__DEC (0x08) |
#define AT86RF2XX_AES_BLOCK_SIZE ((AT86RF2XX_AES_KEY_BITS) / 8) |
AES block size in bytes.
Definition at line 43 of file at86rf2xx_aes.h.
#define AT86RF2XX_AES_CTRL_AES_DIR__DEC (0x08) |
Definition at line 92 of file at86rf2xx_aes.h.
#define AT86RF2XX_AES_CTRL_AES_DIR__ENC (0x00) |
Definition at line 91 of file at86rf2xx_aes.h.
#define AT86RF2XX_AES_CTRL_AES_MODE__CBC (0x20) |
Definition at line 89 of file at86rf2xx_aes.h.
#define AT86RF2XX_AES_CTRL_AES_MODE__ECB (0x00) |
Definition at line 87 of file at86rf2xx_aes.h.
#define AT86RF2XX_AES_CTRL_AES_MODE__KEY (0x10) |
Definition at line 88 of file at86rf2xx_aes.h.
#define AT86RF2XX_AES_CTRL_AES_REQUEST__IDLE (0x00) |
Definition at line 84 of file at86rf2xx_aes.h.
#define AT86RF2XX_AES_CTRL_AES_REQUEST__START (0x80) |
Definition at line 85 of file at86rf2xx_aes.h.
#define AT86RF2XX_AES_CTRL_MASK__AES_DIR (0x08) |
Definition at line 82 of file at86rf2xx_aes.h.
#define AT86RF2XX_AES_CTRL_MASK__AES_MODE (0x70) |
Definition at line 81 of file at86rf2xx_aes.h.
#define AT86RF2XX_AES_CTRL_MASK__AES_REQUEST (0x80) |
Definition at line 80 of file at86rf2xx_aes.h.
#define AT86RF2XX_AES_CTRL_MIRROR_AES_DIR__DEC (0x08) |
Definition at line 111 of file at86rf2xx_aes.h.
#define AT86RF2XX_AES_CTRL_MIRROR_AES_DIR__ENC (0x00) |
Definition at line 110 of file at86rf2xx_aes.h.
#define AT86RF2XX_AES_CTRL_MIRROR_AES_MODE__CBC (0x20) |
Definition at line 108 of file at86rf2xx_aes.h.
#define AT86RF2XX_AES_CTRL_MIRROR_AES_MODE__ECB (0x00) |
Definition at line 106 of file at86rf2xx_aes.h.
#define AT86RF2XX_AES_CTRL_MIRROR_AES_MODE__KEY (0x10) |
Definition at line 107 of file at86rf2xx_aes.h.
#define AT86RF2XX_AES_CTRL_MIRROR_AES_REQUEST__IDLE (0x00) |
Definition at line 103 of file at86rf2xx_aes.h.
#define AT86RF2XX_AES_CTRL_MIRROR_AES_REQUEST__START (0x80) |
Definition at line 104 of file at86rf2xx_aes.h.
#define AT86RF2XX_AES_CTRL_MIRROR_MASK__AES_DIR (0x08) |
Definition at line 101 of file at86rf2xx_aes.h.
#define AT86RF2XX_AES_CTRL_MIRROR_MASK__AES_MODE (0x70) |
Definition at line 100 of file at86rf2xx_aes.h.
#define AT86RF2XX_AES_CTRL_MIRROR_MASK__AES_REQUEST (0x80) |
Definition at line 99 of file at86rf2xx_aes.h.
#define AT86RF2XX_AES_DELAY_US (24) |
Time to complete the AES algorithm in us.
Definition at line 47 of file at86rf2xx_aes.h.
#define AT86RF2XX_AES_KEY_BITS (128U) |
AES key length in bits.
Definition at line 35 of file at86rf2xx_aes.h.
#define AT86RF2XX_AES_KEY_LENGTH ((AT86RF2XX_AES_KEY_BITS) / 8) |
AES key length in bytes.
Definition at line 39 of file at86rf2xx_aes.h.
#define AT86RF2XX_AES_STATUS_AES_DONE__DONE (0x01) |
Definition at line 73 of file at86rf2xx_aes.h.
#define AT86RF2XX_AES_STATUS_AES_DONE__NOT_DONE (0x00) |
Definition at line 72 of file at86rf2xx_aes.h.
#define AT86RF2XX_AES_STATUS_AES_ER__ERROR (0x80) |
Definition at line 70 of file at86rf2xx_aes.h.
#define AT86RF2XX_AES_STATUS_AES_ER__NO_ERROR (0x00) |
Definition at line 69 of file at86rf2xx_aes.h.
#define AT86RF2XX_AES_STATUS_MASK__AES_DONE (0x01) |
Definition at line 67 of file at86rf2xx_aes.h.
#define AT86RF2XX_AES_STATUS_MASK__AES_ER (0x80) |
Definition at line 66 of file at86rf2xx_aes.h.
#define AT86RF2XX_REG__AES_CTRL (0x83) |
Definition at line 54 of file at86rf2xx_aes.h.
#define AT86RF2XX_REG__AES_CTRL_MIRROR (0x94) |
Definition at line 59 of file at86rf2xx_aes.h.
#define AT86RF2XX_REG__AES_DATA_END (0x93) |
Definition at line 58 of file at86rf2xx_aes.h.
#define AT86RF2XX_REG__AES_DATA_START (0x84) |
Definition at line 57 of file at86rf2xx_aes.h.
#define AT86RF2XX_REG__AES_KEY_END (0x93) |
Definition at line 56 of file at86rf2xx_aes.h.
#define AT86RF2XX_REG__AES_KEY_START (0x84) |
Definition at line 55 of file at86rf2xx_aes.h.
#define AT86RF2XX_REG__AES_STATUS (0x82) |
Definition at line 53 of file at86rf2xx_aes.h.
typedef uint8_t aes_block_t[AT86RF2XX_AES_BLOCK_SIZE] |
void at86rf2xx_aes_cbc_decrypt | ( | at86rf2xx_t * | dev, |
aes_block_t * | plain, | ||
uint8_t | key[AT86RF2XX_AES_BLOCK_SIZE], | ||
uint8_t | iv[AT86RF2XX_AES_BLOCK_SIZE], | ||
const aes_block_t * | cipher, | ||
uint8_t | nblocks | ||
) |
Perform AES algorithm and decrypt data blocks in cipher
to plain data blocks, using CBC mode.
[in] | dev | Device |
[out] | plain | If not NUll, plain data blocks |
[out] | key | If not NULL, last round decryption key is stored |
[in,out] | iv | in: initial vector, out: last plain block if plain is NULL |
[in] | cipher | Cipher data blocks |
[in] | nblocks | Number of blocks |
void at86rf2xx_aes_cbc_encrypt | ( | at86rf2xx_t * | dev, |
aes_block_t * | cipher, | ||
uint8_t | key[AT86RF2XX_AES_BLOCK_SIZE], | ||
uint8_t | iv[AT86RF2XX_AES_BLOCK_SIZE], | ||
const aes_block_t * | plain, | ||
uint8_t | nblocks | ||
) |
Perform AES algorithm and encrypt data blocks in plain
to cipher data blocks, using CBC mode.
[in] | dev | Device |
[out] | cipher | If not NULL, cipher blocks |
[out] | key | If not NULL, last round encryption key is stored |
[in,out] | iv | in: initial vector, out: last cipher block if cipher is NULL |
[in] | plain | Plain data blocks |
[in] | nblocks | Number of blocks |
void at86rf2xx_aes_ecb_decrypt | ( | at86rf2xx_t * | dev, |
aes_block_t * | plain, | ||
uint8_t | key[AT86RF2XX_AES_BLOCK_SIZE], | ||
const aes_block_t * | cipher, | ||
uint8_t | nblocks | ||
) |
Perform AES algorithm and decrypt data blocks in cipher
to plain data blocks, using ECB mode.
[in] | dev | Device |
[out] | plain | If not NULL, plain data blocks |
[out] | key | If not NULL, last round decryption key is stored |
[in] | cipher | Cipher data blocks |
[in] | nblocks | Number of blocks |
void at86rf2xx_aes_ecb_encrypt | ( | at86rf2xx_t * | dev, |
aes_block_t * | cipher, | ||
uint8_t | key[AT86RF2XX_AES_BLOCK_SIZE], | ||
const aes_block_t * | plain, | ||
uint8_t | nblocks | ||
) |
Perform AES algorithm and encrypt data blocks in plain
to cipher data blocks, using ECB mode.
[in] | dev | Device |
[out] | cipher | If not NULL, cipher data blocks |
[out] | key | If not NULL, last round encryption key is stored |
[in] | plain | Plain data blocks |
[in] | nblocks | Number of blocks |
void at86rf2xx_aes_key_read_decrypt | ( | at86rf2xx_t * | dev, |
uint8_t | key[AT86RF2XX_AES_KEY_LENGTH] | ||
) |
Read the AES key used for decryption.
[in] | dev | Device |
[out] | key | Buffer to store the key |
void at86rf2xx_aes_key_read_encrypt | ( | at86rf2xx_t * | dev, |
uint8_t | key[AT86RF2XX_AES_KEY_LENGTH] | ||
) |
Read the AES key used for encryption.
[in] | dev | Device |
[out] | key | Buffer to store the key |
void at86rf2xx_aes_key_write_decrypt | ( | at86rf2xx_t * | dev, |
const uint8_t | key[AT86RF2XX_AES_KEY_LENGTH] | ||
) |
Write the AES key used for decryption.
It is important to write the decryption key, before decryption is done
[in] | dev | Device |
[in] | key | Buffer which stores the key |
void at86rf2xx_aes_key_write_encrypt | ( | at86rf2xx_t * | dev, |
const uint8_t | key[AT86RF2XX_AES_KEY_LENGTH] | ||
) |
Write the AES key used for encryption.
It is important to write the encryption key, before encryption is done
[in] | dev | Device |
[in] | key | Buffer which stores the key |