Expand description
Advanced Encryption Standard (AES) hardware accelerator.
This module drives the on-chip AES block. Two hardware revisions are supported, selected automatically from the target chip:
aes_v2(STM32G0, G4, L5, U0, WL) — blocking driver. On these parts the AES engine either shares its interrupt line with another peripheral (e.g. RNG) or has no dedicated line at all, so only a polling/blocking API is offered.aes_v3b(STM32H5, WBA) — blocking driver plus an interrupt/DMA-backed async API.
Both revisions expose the same cipher types and the same
start / aad_blocking /
payload_blocking / finish_blocking
blocking flow, so blocking code is portable across them.
§Supported cipher modes
| Mode | Padding | Auth | Use case |
|---|---|---|---|
| ECB | Required | No | Keys only (not recommended for data) |
| CBC | Required | No | File/disk encryption |
| CTR | No | No | Streaming data, random access |
| GCM | No | Yes | Recommended — modern applications |
| GMAC | No | Yes | Authentication without encryption |
| CCM | No | Yes | Resource-constrained devices |
§Key sizes
- 128-bit (16 bytes) and 256-bit (32 bytes).
- 192-bit keys are not supported by this hardware.
§IV / nonce requirements
- CBC: random, unique per message.
- CTR: must never repeat with the same key.
- GCM/GMAC: 96-bit (12 bytes), unique per message. IV reuse is catastrophic.
Structs§
- Aes
- AES driver.
- AesCbc
- AES-CBC Cipher Mode
- AesCcm
- AES-CCM Cipher Mode (Counter with CBC-MAC)
- AesCtr
- AES-CTR Cipher Mode
- AesEcb
- AES-ECB Cipher Mode
- AesGcm
- AES-GCM Cipher Mode
- AesGmac
- AES-GMAC Cipher Mode (Galois Message Authentication Code)
- Context
- Stores the state of the AES peripheral for a cipher operation.
- Interrupt
Handler - AES interrupt handler.
Enums§
Traits§
- Cipher
- This trait encapsulates all cipher-specific behavior.
- Cipher
Authenticated - This trait enables restriction of a header phase to authenticated ciphers only.
- Cipher
Sized - This trait enables restriction of ciphers to specific key sizes.
- DmaIn
- DmaIn DMA request trait
- DmaOut
- DmaOut DMA request trait
- IVSized
- This trait enables restriction of initialization vectors to sizes compatible with a cipher mode.
- Instance
- AES instance trait.