KCAPI_CIPHER_DEC_AES(3)

πŸ’– KCAPI_CIPHER_DEC_AES β€” bestie edition πŸ’–

ok so like. this is kcapi_cipher_dec_aes_ctr, a lil convenience function living in the libkcapi manual (section 3, for the girlies who read man pages for fun πŸŽ€). she's a one-call wonder for AES CTR decryption and she is so easy to love.


✨ NAME ✨

kcapi_cipher_dec_aes_ctr β€” the convenience function for AES CTR decryption. no cap, that's literally her whole job description πŸ’…


🌸 SYNOPSIS 🌸

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

she returns an ssize_t, she takes seven args, and she does not want to hear your opinions about it 🫢


πŸ¦‹ ARGUMENTS πŸ¦‹

ok bestie here's the whole cast, in order, main character first:

  • key β€” [in] the key buffer. this is the secret, guard her with your life πŸ”
  • keylen β€” [in] length of the key buffer. yes this matters a lot, keep reading.
  • in β€” [in] the ciphertext data buffer. this is the messy locked-up stuff coming in.
  • inlen β€” [in] length of the in buffer.
  • ctr β€” [in] the start counter value to be used for the cipher operation. iconic, 16 bytes, no substitutions.
  • out β€” [out] the plaintext data buffer. this is where the glow-up lands ✨
  • outlen β€” [in] length of the out buffer.

πŸ’« DESCRIPTION πŸ’«

so what does she actually do? the convenience function performs an AES counter mode encryption operation using the provided key, the given input buffer and the given IV. the output is stored in the out buffer. one call, done, periodt.

the input buffer can be of arbitrary length. no notes, she eats any size.

the output buffer must be at least as large as the input buffer. so like, don't skimp on out, she needs room to breathe 😭

the start counter can contain all zeros β€” and lowkey that's fine, that's valid β€” but not a NULL buffer! a NULL is a hard no. also she must be exactly 16 bytes in size. exactly. not 15, not 17. sixteen. πŸ’€

the AES type (AES-128, AES-192 or AES-256) is determined by the size of the given key, so like, the key length is the vibe check:

  • a 16 byte key means AES-128 is used.
  • a 24 byte key implies AES-192.
  • a 32 byte key implies AES-256.

and the return value? on success she hands you the number of bytes generated; if something went wrong you get a negative errno-style error code. negative = not slay, check your errno 🚨

real talk: this is the decryption convenience wrapper, but the description says it performs an AES counter mode encryption operation β€” CTR mode is symmetric like that, so don't come for me, I'm just telling you what the page says πŸ™ˆ

πŸ‘‘ AUTHOR πŸ‘‘

  • Stephan Mueller <smueller@chronox.de> β€” Author. the legend, the blueprint, the moment ⭐

that's the whole page bestie, you're fully caught up 🧚


sending you off with the receipts: this came from the libkcapi Manual, version 1.5.0, dated July 2025, and the page is KCAPI_CIPHER_DEC_AES(3). go decrypt something cute πŸ’–πŸ¦‹πŸŒΈ

πŸ“¦ where this page comes from