---
name: "rijndael"
section: "9"
platform: "freebsd"
package: "base"
version: "16.0-CURRENT-20261027-61c70dc16a79"
release: "FreeBSD 16.0-CURRENT (2026-10-27)"
platforms: ["linux", "freebsd"]
url: "https://new.carta.tech/rijndael"
---

# rijndael(9)

AES encryption

## NAME

**rijndael\_makeKey**, **rijndael\_cipherInit**, **rijndael\_blockEncrypt**, **rijndael\_padEncrypt**, **rijndael\_blockDecrypt**, **rijndael\_padDecrypt** – AES encryption

## SYNOPSIS

**#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

The **rijndael\_makeKey**() function is used to set up the key schedule in *key*. The *direction* (which may be DIR\_ENCRYPT or DIR\_DECRYPT) specifies the intended use of the key. The length of the key (in bits) is given in *keyLen*, and must be 128, 192 or 256. The actual key is supplied in the buffer pointed to by *keyMaterial*. This material may be raw binary data, or an ASCII string containing a hexadecimal rendition of the raw binary data, dependent on a compile-time option in the **rijndael\_makeKey** sources, BINARY\_KEY\_MATERIAL.

## RETURN VALUES

The **rijndael\_makeKey**() function will return 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), and TRUE otherwise.

## AUTHORS

Mark R V Murray
