AESNI(4)
π AESNI π
okay bestie, gather round, because today we're talking about aesni β the driver for the AES and SHA accelerator on x86 CPUs. yes that's the whole name section, slay, let's go β¨
πΈ SYNOPSIS πΈ
so if you wanna bake this driver into your kernel, you drop these lines into your kernel configuration file, no cap:
device crypto
device cryptodev
device aesni
OR β and this is the main character move β you can just load it as a module at boot time instead, by putting this line in loader.conf(5):
aesni_load="YES"
pick your fighter, both are valid π
β¨ DESCRIPTION β¨
okay so here's the lore. starting with Intel Westmere and AMD Bulldozer, some x86 processors started implementing a whole new set of instructions called AESNI. it's six instructions, and they accelerate the calculation of the key schedule for key lengths of 128, 192, and 256 of the Advanced Encryption Standard (AES) symmetric cipher β and on top of that they give you a hardware implementation of the regular and the last encryption and decryption rounds. like, the CPU is literally doing the crypto for you. iconic behavior honestly π«Ά
the processor capability gets reported as AESNI in the Features2 line at boot. so you can peek at boot and vibe check your own CPU, iykyk.
then, starting with the Intel Goldmont and AMD Ryzen microarchitectures, some x86 processors implement a new set of SHA instructions. that's seven instructions, and they accelerate the calculation of SHA1 and SHA256 hashes. π₯
that processor capability gets reported as SHA in the Structured Extended Features line at boot.
now here's the important part, so listen up: the aesni driver does not attach on systems that lack both CPU capabilities. but on systems that support only one of AESNI or SHA extensions, the driver will attach and support that one function. so it's not all-or-nothing, it's flexible, she adapts π
the aesni driver registers itself to accelerate AES and SHA operations for crypto(4). and like, besides the speed (which is obviously the headline), the real glow-up of using aesni is that the AESNI operation is data-independent β which means it eliminates some attack vectors based on measuring cache use and timings that are typically present in table-driven implementations. so it's fast and it's safer. the way that it's just better on every axis?? obsessed. πβ¨
π SEE ALSO π
π¦ HISTORY π¦
the aesni driver first appeared in FreeBSD 9.0. the SHA support was added later, in FreeBSD 12.0. glow-up era, fr fr.
π AUTHORS π
the aesni driver was written by Konstantin Belousov <kib@FreeBSD.org> and Conrad Meyer <cem@FreeBSD.org>. the key schedule calculation code was adopted from the sample provided by Intel and used in the analogous OpenBSD driver. and the hash step intrinsics implementations were supplied by Intel. thank you legends, we owe you everything ππ
and that's the whole page bestie!! this one came from the Debian crew, dated September 26, 2017, and it's the AESNI(4) page from the Kernel Interfaces Manual. mwah, go encrypt something safely π
π
π¦ where this page comes from
- debian bookworm: freebsd-manpages 12.2-1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- debian trixie: freebsd-manpages 12.2-2 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu jammy: freebsd-manpages 12.2-1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu noble: freebsd-manpages 12.2-1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu questing: freebsd-manpages 12.2-2
- ubuntu resolute: freebsd-manpages 12.2-2build1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu stonking: freebsd-manpages 12.2-2build1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- Copyright (c) 2010 Konstantin Belousov <kib@FreeBSD.org>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms