Implementation of hal_aes for nRF24LU1+. More...
#include "nrf24lu1p.h"#include <stdint.h>#include "hal_aes.h"Go to the source code of this file.
Defines | |
| #define | AES_BUF_SIZE 16 |
| #define | AESCS_MODE_MASK 0x1C |
| #define | AESCS_GO_MASK 0x01 |
| #define | AESCS_E_D_MASK 0x02 |
| #define | AESCS_E_D_BIT_POS 1 |
| #define | DECRYPT 1 |
| #define | ENCRYPT 0 |
| #define | AESIA1_KIN_MASK 0xf0 |
| #define | AESIA1_KIN_B0_POS 4 |
| #define | AESIA1_IV_MASK 0x0f |
| #define | AESIA1_IV_B0_POS 0 |
| #define | AESIA2_DI_MASK 0xf0 |
| #define | AESIA2_DI_B0_POS 4 |
| #define | AESIA2_DO_MASK 0x0f |
| #define | AESIA2_DO_B0_POS 0 |
Functions | |
| void | aes_set_mode (uint8_t mode) |
| void | aes_select_e_d (uint8_t operation) |
| void | aes_go () |
| uint8_t | aes_busy () |
| void | aes_data_write_buf (uint8_t *buf, uint8_t indirect_start_address, uint8_t length) |
| void | aes_data_read_buf (uint8_t *buf, uint8_t indirect_start_address, uint8_t length) |
| void | aes_keyin_write_buf (const uint8_t *buf, uint8_t indirect_address, uint8_t length) |
| void | aes_initvect_write_buf (const uint8_t *buf, uint8_t indirect_start_address, uint8_t length) |
| void | hal_aes_setup (_Bool decrypt, aes_modes_t mode, uint8_t *keyin, uint8_t *ivin) |
| void | hal_aes_crypt (uint8_t *dest_buf, uint8_t *src_buf) |
| void | hal_aes_get_dec_key (uint8_t *output_dec_key, uint8_t *input_enc_key) |
Implementation of hal_aes for nRF24LU1+.
Implementation of hardware abstraction layer (HAL) for the embedded AES co-processor in nRF24LU1
Definition in file hal_aes.c.
| void aes_set_mode | ( | uint8_t | mode ) |
Definition at line 159 of file hal_aes.c.
{
AESCS=(AESCS & ~AESCS_MODE_MASK) | mode<<2;
}
| void aes_select_e_d | ( | uint8_t | operation ) |
Definition at line 164 of file hal_aes.c.
{
AESCS=(AESCS & ~AESCS_E_D_MASK) | operation<<1;
}
| void aes_go | ( | ) |
Definition at line 170 of file hal_aes.c.
{
AESCS=AESCS | AESCS_GO_MASK;
}
| uint8_t aes_busy | ( | ) |
Definition at line 175 of file hal_aes.c.
{
return AESCS & AESCS_GO_MASK;
}
| void aes_data_write_buf | ( | uint8_t * | buf, |
| uint8_t | indirect_start_address, | ||
| uint8_t | length | ||
| ) |
Definition at line 180 of file hal_aes.c.
{
int8_t index;
AESIA2= (AESIA2 & ~AESIA2_DI_MASK) | (indirect_start_address << AESIA2_DI_B0_POS);
for(index=length-1; index>=0; index--)
{
AESD=buf[index];
}
}
| void aes_data_read_buf | ( | uint8_t * | buf, |
| uint8_t | indirect_start_address, | ||
| uint8_t | length | ||
| ) |
Definition at line 190 of file hal_aes.c.
{
int8_t index;
AESIA2= (AESIA2 & ~AESIA2_DO_MASK) | (indirect_start_address << AESIA2_DO_B0_POS);
for(index=length-1; index>=0; index--)
{
buf[index]=AESD;
}
}
| void aes_keyin_write_buf | ( | const uint8_t * | buf, |
| uint8_t | indirect_address, | ||
| uint8_t | length | ||
| ) |
Definition at line 200 of file hal_aes.c.
{
int8_t index;
AESIA1= (AESIA1 & ~AESIA1_KIN_MASK) | (indirect_start_address << AESIA1_KIN_B0_POS);
for(index=length-1; index>=0; index--)
{
AESKIN=buf[index];
}
}
| void aes_initvect_write_buf | ( | const uint8_t * | buf, |
| uint8_t | indirect_start_address, | ||
| uint8_t | length | ||
| ) |
Definition at line 210 of file hal_aes.c.
{
int8_t index;
AESIA1= (AESIA1 & ~AESIA1_IV_MASK) | (indirect_start_address << AESIA1_IV_B0_POS);
for(index=length-1; index>=0; index--)
{
AESIV=buf[index];
}
}
1.7.2