Module aes

Module aes 

Source
Available on crate feature unstable only.
Expand description

§Advanced Encryption Standard (AES).

§Overview

The AES accelerator is a hardware device that speeds up computation using AES algorithm significantly, compared to AES algorithms implemented solely in software. The AES accelerator has two working modes, which are Typical AES and AES-DMA.

§Configuration

The AES peripheral can be configured to encrypt or decrypt data using different encryption/decryption modes.

When using AES-DMA, the peripheral can be configured to use different block cipher modes such as ECB, CBC, OFB, CTR, CFB8, and CFB128.

§Examples

§Encrypting and decrypting a message

Simple example of encrypting and decrypting a message using AES-128:

let mut block = [0_u8; 16];
block[..plaintext.len()].copy_from_slice(plaintext);

let mut aes = Aes::new(peripherals.AES);
aes.encrypt(&mut block, keybuf);

// The encryption happens in-place, so the ciphertext is in `block`

aes.decrypt(&mut block, keybuf);

// The decryption happens in-place, so the plaintext is in `block`

Modules§

cipher_modes
Software implementations of the supported block cipher operating modes.
dma
Provides DMA (Direct Memory Access) support for AES operations.

Structs§

Aes
AES peripheral container
AesBackend
CPU-driven AES processing backend.
AesContext
An AES work queue user.
AesHandle
The handle to the pending AES operation.
AesWorkQueueDriver
An active work queue driver.

Enums§

CipherState
The stored state of various block cipher modes.
Error
An error related to an AES operation.
Key
Represents the various key sizes allowed for AES encryption and decryption.
Operation
The possible AES operations.