Expand description
Advanced Encryption Standard (AES) hardware accelerator.
This module drives the on-chip AES block. The hardware revisions below are supported, selected automatically from the target chip:
aes_v1(STM32L0, L1, L4, F423) — blocking driver, plus an interrupt-driven async API where the engine has its own interrupt (L4). This revision only does ECB, CBC and CTR with 128-bit keys.aes_v2(STM32G0, G4, L5, U0, WL) — blocking driver, plus an interrupt-driven async API where the engine has its own interrupt (L5, WL). Elsewhere the engine shares its interrupt line with another peripheral (e.g. RNG) or has no dedicated line at all, so only the blocking API is offered.aes_f7(STM32F72x, F73x) — same register map asaes_v2minus theNPBLBfield, so a final partial payload block cannot be masked out of the authentication: GCM (both directions) and CCM decryption returnError::ConfigErrorwhen the payload is not a multiple of 16 bytes.aes_v3a(STM32U5) andaes_v3b(STM32H5, WBA) — blocking driver plus an interrupt/DMA-backed async API. The two revisions have the same register map.
All 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 |
GCM, GMAC and CCM are not available on aes_v1.
§Key sizes
- 128-bit (16 bytes) and 256-bit (32 bytes); only 128-bit on
aes_v1. - 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.