Module nrf52::aes

source ·
Expand description

AES128 driver, nRF5X-family

Provides a simple driver to encrypt and decrypt messages using aes128-ctr mode on top of aes128-ecb, as well as encrypt with aes128-ecb and aes128-cbc.

Roughly, the module uses three buffers with the following content:

  • Key
  • Initial counter
  • Payload, to be encrypted or decrypted


The key is used for getting a key and configure it in the AES chip

§Initial Counter

Counter to be used for aes-ctr and it is entered into AES to generate the the keystream. After each encryption the initial counter is incremented


Data to be encrypted or decrypted it is XOR:ed with the generated keystream

§Things to highlight that can be improved:

  • ECB_DATA must be a static mut [u8] and can’t be located in the struct
  • PAYLOAD size is restricted to 128 bytes