KCAPI_CIPHER_ENC_AES(3)
π KCAPI_CIPHER_ENC_AES(3) β the aes-ctr encryption glow-up π
okay bestie, gather round, because we're talking about kcapi_cipher_enc_aes_ctr from the libkcapi manual, and honestly? she's a whole convenience queen. π
β¨ NAME β¨
kcapi_cipher_enc_aes_ctr β the convenience function for AES CTR encryption. no cap, that's literally her whole job. π
πΈ SYNOPSIS πΈ
ssize_t kcapi_cipher_enc_aes_ctr(const uint8_t * key, uint32_t keylen,
const uint8_t * in, size_t inlen,
const uint8_t * ctr, uint8_t * out,
size_t outlen);
π¦ ARGUMENTS π¦
she takes six things and every single one matters, so pay attention bestie:
keyβ [in] the key buffer. your whole secret vibe lives here. πkeylenβ [in] length of the key buffer. yes we need this, don't be weird about it.inβ [in] plaintext data buffer. this is the tea before it gets scrambled. πinlenβ [in] length of theinbuffer.ctrβ [in] the start counter value that gets used for the cipher operation. βoutβ [out] ciphertext data buffer. this is where the encrypted icon behavior lands. β¨outlenβ [in] length of theoutbuffer.
π DESCRIPTION π
so the convenience function does an AES counter mode encryption operation, using the key you gave her, the input buffer you gave her, and the IV you gave her. the output gets stored in the out buffer. simple. iconic. periodt. π
the input buffer can be of arbitrary length. go off, honestly. π
the output buffer must be at least as large as the input buffer. no shrinking allowed, she's not that kind of function. π
the start counter can contain all zeros β and bestie, listen, that is not a NULL buffer! β and it must be exactly 16 bytes in size. not 15, not 17. sixteen. exactly. π
the AES type (AES-128, AES-192 or AES-256) is determined by the size of the key you hand over:
- if the key is 16 bytes long, AES-128 is used.
- a 24 byte key implies AES-192.
- a 32 byte key implies AES-256.
and the return value? it's giving: number of bytes generated upon success. and if something went wrong, you get a negative errno-style error code. π
lowkey important: the return is the byte count on success and a negative errno-style error code on failure. don't mix those two up, i'm begging. π«Ά
π AUTHOR π
Stephan Mueller <smueller@chronox.de>
- Author. yes, the author. we stan. π
π COPYRIGHT π
that's the whole page, bestie β courtesy of the libkcapi Manual 1.5.0, dated July 2025, and you can find her filed under KCAPI_CIPHER_ENC_AES(3). slay, encrypt responsibly, and remember: exactly 16 bytes of counter. mwah. π
β¨π
π¦ where this page comes from
- fedora 43: libkcapi-devel 1.5.0-6.fc43 Β· BSD-3-Clause OR GPL-2.0-only
- fedora 43: libkcapi-devel 1.5.0-6.fc43 Β· BSD-3-Clause OR GPL-2.0-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms