RIJNDAEL(9)

πŸ“¦ version 15.1, in freebsd 14.5, freebsd 15.1, nixpkgs unstable

πŸ’– NAME πŸ’–

okay so bestie, this is RIJNDAEL(9) from the Kernel Developer's Manual, and it is literally the page for AES encryption ✨. The whole squad is:

  • rijndael_makeKey
  • rijndael_cipherInit
  • rijndael_blockEncrypt
  • rijndael_padEncrypt
  • rijndael_blockDecrypt
  • rijndael_padDecrypt

🌸 SYNOPSIS 🌸

Here's the exact include-and-signature moment, no cap:

#include <sys/types.h>
#include <crypto/rijndael.h>

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);

πŸŽ€ DESCRIPTION πŸŽ€

So rijndael_makeKey() is the function that sets up the key schedule in key. It’s giving β€œget your key situation ready” energy πŸ’….

The direction tells it what the key is for, and it may be DIR_ENCRYPT or DIR_DECRYPT.

The key length in bits lives in keyLen, and it must be 128, 192 or 256. No random numbers, bestie 😭.

The actual key comes from the buffer pointed to by keyMaterial. That material may be raw binary data, or an ASCII string containing a hexadecimal rendition of the raw binary data. Which one? It depends on a compile-time option in the rijndael_makeKey sources: BINARY_KEY_MATERIAL.

πŸ¦‹ RETURN VALUES πŸ¦‹

rijndael_makeKey() returns:

  • BAD_KEY_INSTANCE if a NULL key is passed.
  • BAD_KEY_DIR if direction is not DIR_ENCRYPT or DIR_DECRYPT.
  • BAD_KEY_MAT if the key materials are not a hexadecimal string (and binary keys are not set).
  • TRUE otherwise.

πŸ‘‘ AUTHORS πŸ‘‘

Mark R V Murray. Shoutout to the icon who wrote this one πŸ’….


Source/version: Debian. Date: February 6, 2002. Manual page: RIJNDAEL(9). That’s the tea β€” bye bestie πŸ«ΆπŸ’–

πŸ“¦ where this page comes from