KCAPI_CIPHER_DEC_AES(3)
π KCAPI_CIPHER_DEC_AES(3) π
okay bestie, welcome to the Programming Interface section of the manual β this is page KCAPI_CIPHER_DEC_AES(3) and she is specifically about one lil glow-up of a function. sit down, hydrate, let's go π«Ά
β¨ NAME β¨
kcapi_cipher_dec_aes_cbc β the convenience function for AES CBC decryption. that's it, that's her whole job, and she does it beautifully π
πΈ SYNOPSIS πΈ
ssize_t kcapi_cipher_dec_aes_cbc(const uint8_t * key, uint32_t keylen,
const uint8_t * in, size_t inlen,
const uint8_t * iv, uint8_t * out,
size_t outlen);
π ARGUMENTS π
keyβ[in]the key buffer, like the actual secret ingredientkeylenβ[in]how long that key buffer isinβ[in]your ciphertext data buffer (the scrambled stuff you wanna unscramble)inlenβ[in]length of theinbufferivβ[in]the IV to be used for the cipher operationoutβ[out]the plaintext data buffer (where the decoded magic lands)outlenβ[in]length of theoutbuffer
π¦ DESCRIPTION π¦
so this convenience function does an AES CBC decryption operation, using the key you gave it, the input buffer you gave it, and the IV you gave it. the output goes and lives in the out buffer. simple as that, no cap π
heads up bestie, this part is real: AES CBC requires input data that is a multiple of 16 bytes. if your data isn't guaranteed to be multiples of 16 bytes, you've got options: either add zero bytes at the end of the buffer to pad it up to a multiple of 16 bytes, or the CTR mode encryption operation may be usable instead. pick your fighter β¨
the output buffer must be at least as large as the input buffer. no shrinking allowed, she needs room to breathe.
the IV must be exactly 16 bytes in size. exactly. not 15, not 17. sixteen. π―
and the AES type (AES-128, AES-192 or AES-256) is determined by the size of the key you hand over:
- key is 16 bytes long β AES-128 is used
- key is 24 bytes β that implies AES-192
- key is 32 bytes β that implies AES-256
the return value: number of bytes generated upon success; a negative errno-style error code if an error occurred. so if you get a negative number back, that's the universe telling you something went sideways π
π AUTHOR π
Stephan Mueller <smueller@chronox.de>
- Author. (iconic behavior, honestly)
π COPYRIGHT π
and that's the whole page, bestie! this was libkcapi Manual 1.5.0, dated July 2025 β go forth and decrypt responsibly, you absolute main character π§ββοΈπβ¨
π¦ 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