Bouffalo SDK  1.0
Bouffalolab Software Development Kit
SEC_AES
Collaboration diagram for SEC_AES:

Modules

 aes mode definition
 
 aes link mode keybits definition
 

Data Structures

struct  bflb_aes_link_s
 
struct  bflb_aes_xts_link_s
 

Macros

#define AES_LINK_XTS_MODE1   0
 
#define AES_LINK_XTS_MODE2   1
 

Functions

struct bflb_aes_link_s __attribute__ ((aligned(4)))
 
void bflb_aes_init (struct bflb_device_s *dev)
 Enable aes. More...
 
void bflb_aes_deinit (struct bflb_device_s *dev)
 Disable aes. More...
 
void bflb_aes_set_hwkey (uint8_t keysel)
 Set aes hardware key. More...
 
void bflb_aes_set_hwkey_source (struct bflb_device_s *dev, uint8_t source)
 Set aes hardware key source. More...
 
void bflb_aes_set_mode (struct bflb_device_s *dev, uint8_t mode)
 Set aes mode. More...
 
void bflb_aes_setkey (struct bflb_device_s *dev, const uint8_t *key, uint16_t keybits)
 Set aes key. More...
 
int bflb_aes_encrypt (struct bflb_device_s *dev, const uint8_t *input, const uint8_t *iv, uint8_t *output, uint32_t len)
 Perform aes encrypt. More...
 
int bflb_aes_decrypt (struct bflb_device_s *dev, const uint8_t *input, const uint8_t *iv, uint8_t *output, uint32_t len)
 Perform aes decrypt. More...
 
void bflb_aes_link_init (struct bflb_device_s *dev)
 Enable aes link mode. More...
 
void bflb_aes_link_deinit (struct bflb_device_s *dev)
 Disable aes link mode. More...
 
int bflb_aes_link_update (struct bflb_device_s *dev, uint32_t link_addr, const uint8_t *input, uint8_t *output, uint32_t len)
 Perform encrypt or decrypt with link mode. More...
 
void bflb_group0_request_aes_access (struct bflb_device_s *dev)
 Enable aes in group0. More...
 
void bflb_group0_release_aes_access (struct bflb_device_s *dev)
 Disable aes in group0. More...
 

Detailed Description

Macro Definition Documentation

◆ AES_LINK_XTS_MODE1

#define AES_LINK_XTS_MODE1   0

Definition at line 36 of file bflb_sec_aes.h.

◆ AES_LINK_XTS_MODE2

#define AES_LINK_XTS_MODE2   1

Definition at line 37 of file bflb_sec_aes.h.

Function Documentation

◆ __attribute__()

struct bflb_aes_link_s __attribute__ ( (aligned(4))  )

◆ bflb_aes_decrypt()

int bflb_aes_decrypt ( struct bflb_device_s dev,
const uint8_t *  input,
const uint8_t *  iv,
uint8_t *  output,
uint32_t  len 
)

Perform aes decrypt.

Parameters
[in]devdevice handle
[in]inputpointer to ciphertext
[in]ivinput iv, if NULL, means use last iv.
[in]outputpointer to plaintext
[in]lendecrypt length, muse be multiple of 16
Returns
A negated errno value on failure.

◆ bflb_aes_deinit()

void bflb_aes_deinit ( struct bflb_device_s dev)

Disable aes.

Parameters
[in]dev

◆ bflb_aes_encrypt()

int bflb_aes_encrypt ( struct bflb_device_s dev,
const uint8_t *  input,
const uint8_t *  iv,
uint8_t *  output,
uint32_t  len 
)

Perform aes encrypt.

Parameters
[in]devdevice handle
[in]inputpointer to plaintext
[in]ivinput iv, if NULL, means use last iv.
[in]outputpointer to ciphertext
[in]lenencrypt length, muse be multiple of 16
Returns
A negated errno value on failure.

◆ bflb_aes_init()

void bflb_aes_init ( struct bflb_device_s dev)

Enable aes.

Parameters
[in]dev

◆ bflb_aes_link_deinit()

void bflb_aes_link_deinit ( struct bflb_device_s dev)

Disable aes link mode.

Parameters
[in]devdevice handle

◆ bflb_aes_link_init()

void bflb_aes_link_init ( struct bflb_device_s dev)

Enable aes link mode.

Parameters
[in]devdevice handle

◆ bflb_aes_link_update()

int bflb_aes_link_update ( struct bflb_device_s dev,
uint32_t  link_addr,
const uint8_t *  input,
uint8_t *  output,
uint32_t  len 
)

Perform encrypt or decrypt with link mode.

Parameters
[in]devdevice handle
[in]link_addrlink struct pointer address, must be located in 0x2xxxxxxx
[in]inputpointer to plaintext or ciphertext
[in]outputpointer to plaintext or ciphertext
[in]lenupdate length, muse be multiple of 16
Returns
A negated errno value on failure.

◆ bflb_aes_set_hwkey()

void bflb_aes_set_hwkey ( uint8_t  keysel)

Set aes hardware key.

Parameters
[in]keyselhardware key mode in efuse table

◆ bflb_aes_set_hwkey_source()

void bflb_aes_set_hwkey_source ( struct bflb_device_s dev,
uint8_t  source 
)

Set aes hardware key source.

Parameters
[in]devdevice handle
[in]sourcehardware key source

◆ bflb_aes_set_mode()

void bflb_aes_set_mode ( struct bflb_device_s dev,
uint8_t  mode 
)

Set aes mode.

Parameters
[in]devdevice handle
[in]modeaes mode, use aes mode definition

◆ bflb_aes_setkey()

void bflb_aes_setkey ( struct bflb_device_s dev,
const uint8_t *  key,
uint16_t  keybits 
)

Set aes key.

Parameters
[in]devdevice handle
[in]keypointer to aes key, if NULL, means use hardware key
[in]keybitsaes keybits, can be 128/192/256

◆ bflb_group0_release_aes_access()

void bflb_group0_release_aes_access ( struct bflb_device_s dev)

Disable aes in group0.

Parameters
[in]devdevice handle

◆ bflb_group0_request_aes_access()

void bflb_group0_request_aes_access ( struct bflb_device_s dev)

Enable aes in group0.

Parameters
[in]devdevice handle