RIJNDAEL(9)
β¨ RIJNDAEL(9) β AES encryption, but make it a vibe β¨
okay bestie, welcome to the kernel developer's manual page for rijndael π
this is section 9 of the Kernel Developer's Manual, and it's literally all about AES encryption. sit down, grab a strawberry π, we're doing crypto.
πΈ NAME πΈ
rijndael_makeKey, rijndael_cipherInit, rijndael_blockEncrypt, rijndael_padEncrypt, rijndael_blockDecrypt, rijndael_padDecrypt β AES encryption
no cap, that's the whole roster. six little functions, one iconic cipher π
π SYNOPSIS π
first things first, you gotta include the headers or nothing works, obviously:
#include <sys/types.h>
#include <crypto/rijndael.h>
and here's the full cast, character for character, don't @ me:
int
rijndael_makeKey(keyInstance *key, uint8_t direction, int keyLen,
char *keyMaterial);
int
rijndael_cipherInit(cipherInstance *cipher, uint8_t mode, char *IV);
int
rijndael_blockEncrypt(cipherInstance *cipher, keyInstance *key,
uint8_t *input, int inputLen, uint8_t *outBuffer);
int
rijndael_padEncrypt(cipherInstance *cipher, keyInstance *key,
uint8_t *input, int inputOctets, uint8_t *outBuffer);
int
rijndael_blockDecrypt(cipherInstance *cipher, keyInstance *key,
uint8_t *input, int inputLen, uint8_t *outBuffer);
int
rijndael_padDecrypt(cipherInstance *cipher, keyInstance *key,
uint8_t *input, int inputOctets, uint8_t *outBuffer);
like, look at them. main character energy, every single one π
π DESCRIPTION π
so here's the tea. the rijndael_makeKey() function is the one that sets up the key schedule inside key. that's its whole job, and it does it flawlessly.
the direction tells it what the key is for, and it has to be either DIR_ENCRYPT or DIR_DECRYPT β like, are we locking it in or unlocking it, bestie? pick one π«Ά
the length of the key, in bits, goes in keyLen, and it must be 128, 192 or 256. those are the only three options, periodt. don't try anything else.
and then the actual key itself lives in the buffer that keyMaterial points to. now, here's the little plot twist π: that material can be either
- raw binary data, or
- an ASCII string holding a hexadecimal rendition of the raw binary data
which one you get depends on a compile-time option in the rijndael_makeKey sources called BINARY_KEY_MATERIAL. so it's giving β¨build-dependent behaviourβ¨, iykyk.
π₯ RETURN VALUES π₯
rijndael_makeKey() is gonna hand you back one of these, so pay attention:
BAD_KEY_INSTANCEβ if you passed aNULLkey. not me forgetting to allocate πBAD_KEY_DIRβ ifdirectionisn'tDIR_ENCRYPTorDIR_DECRYPTBAD_KEY_MATβ if the key materials aren't a hexadecimal string (and binary keys are not set)TRUEβ otherwise! slay, it worked π
π AUTHORS π
Mark R V Murray
the icon, the legend, the moment π
okay that's the whole page bestie, go forth and encrypt responsibly π¦
Debian Β· February 6, 2002 β that's the source/version and date this lil page came from, mwah π
π¦ 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) 2002 Mark R V Murray. All rights reserved
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms