Skip to main content

Module aes

Module aes 

Source
Expand description

AES accelerator, as a single-block primitive.

esp-hal’s driver covers ECB/CBC/OFB/CTR over buffers. This wraps the one operation a message-at-a-time consumer needs — one 16-byte block under a 128-bit key — because that is what short-message crypto is built from: a CTR keystream for a single block is encrypt_block(key, nonce), and the caller XORs.

Why bother, rather than a software cipher: aes::soft::fixslice costs ~3.6 KiB of code on xtensa and re-expands the key schedule for every message. The accelerator costs neither, and the key never enters a software key schedule at all.

The driver owns the peripheral (crate::board::SystemResources::aes), so one task holds it. Sharing it between tasks means wrapping it the way any other single-owner peripheral is wrapped — there is no internal locking here, deliberately: a lock whose contention nobody measured is worse than an owner.

Structs§

Aes128
One-block AES-128 on the hardware accelerator.